diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f18085e3..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,33 +0,0 @@ -- **2022-01-18** - `4.1.0` - Async Actions support. -- **2021-06-14** - `4.0.0` - Bumped required ruby version, bumped dependencies, added `Consents` API support, remove deprecated `URI.escape`. -- **2020-03-09** - `3.0.0` - Bumped required ruby version, bumped dependencies, added `list` method in Customers module. -- **2019-06-19** - `2.4.0` - Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region. -- **2019-05-09** - `2.3.0` - Added `create_publication` method in Distributions module. -- **2019-04-23** - `2.2.0` - Loyalties API, Rewards API, Orders API. -- **2019-02-19** - `2.1.1` - Treat `referral` as optional in custom events. Added new method for custom event tracking. -- **2019-02-19** - `2.1.0` - Handle `referral` in custom events tracking. -- **2018-12-27** - `2.0.0` - Business validation rules. -- **2018-09-05** - `1.6.1` - Request timeout settings -- **2017-11-16** - `1.6.0` - Expose promotion API, Redemptions and Validations namespace update -- **2017-11-16** - `1.5.0` - Expose events API -- **2017-05-07** - `1.4.0` - Segments, Validation rules, API Versioning -- **2017-03-22** - `1.3.0` - improved error handling -- **2017-01-04** - `1.2.0` - added [import vouchers](#import-vouchers) method. -- **2016-12-29** - `1.1.0` - introduced [campaigns api](#campaigns-api) and [products api](#products-api). -- **2016-12-15** - `1.0.0` - introduced namespaces, unified method names, updated README. Migration from versions 0.x required [migration from version 0.x](#migration-from-0x) -- **2016-12-02** - `0.8.2` - support gift vouchers in utils, fix price and discount calculations for amount discounts -- **2016-10-03** - `0.8.1` - publish update -- **2016-08-02** - `0.8.0` - validate voucher -- **2016-07-18** - `0.7.0` - voucher udpate -- **2016-07-05** - `0.6.0` - new utils module -- **2016-06-16** - `0.5.0` - unified naming convention -- **2016-06-12** - `0.4.0` - new customer sdk methods -- **2016-05-24** - `0.3.0` - new publish structure -- **2016-04-27** - `0.2.0` - rollback redemption -- **2016-04-13** - `0.1.3` - bugfix in redeem() -- **2016-04-13** - `0.1.2` - removed dependency to `pry` -- **2016-04-12** - `0.1.1` - minor gemspec changes -- **2016-04-12** - `0.1.0` - First version: - - Authentication - - Voucher information: *retrieve voucher*, *list vouchers*, *retrieve redemptions*, *list redemptions* - - Voucher operations: *redeem voucher*, *publish voucher*, *create voucher*, *enable/disable voucher* diff --git a/DEPRECATED_CHANGELOG.md b/DEPRECATED_CHANGELOG.md new file mode 100644 index 00000000..4f5aaf8f --- /dev/null +++ b/DEPRECATED_CHANGELOG.md @@ -0,0 +1,35 @@ +- **2024-05-08** - `5.0.1` - Added support for [Create validation rule assignment](https://docs.voucherify.io/reference/create-validation-rule-assignment) +- **2024-03-11** - `5.0.0` - The new version generated from OpenAPI, supports union models. Covers most common endpoints. +- **2022-01-18** - `4.1.0` - Async Actions support. +- **2021-06-14** - `4.0.0` - Bumped required ruby version, bumped dependencies, added `Consents` API support, remove deprecated `URI.escape`. +- **2020-03-09** - `3.0.0` - Bumped required ruby version, bumped dependencies, added `list` method in Customers module. +- **2019-06-19** - `2.4.0` - Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region. +- **2019-05-09** - `2.3.0` - Added `create_publication` method in Distributions module. +- **2019-04-23** - `2.2.0` - Loyalties API, Rewards API, Orders API. +- **2019-02-19** - `2.1.1` - Treat `referral` as optional in custom events. Added new method for custom event tracking. +- **2019-02-19** - `2.1.0` - Handle `referral` in custom events tracking. +- **2018-12-27** - `2.0.0` - Business validation rules. +- **2018-09-05** - `1.6.1` - Request timeout settings +- **2017-11-16** - `1.6.0` - Expose promotion API, Redemptions and Validations namespace update +- **2017-11-16** - `1.5.0` - Expose events API +- **2017-05-07** - `1.4.0` - Segments, Validation rules, API Versioning +- **2017-03-22** - `1.3.0` - improved error handling +- **2017-01-04** - `1.2.0` - added [import vouchers](#import-vouchers) method. +- **2016-12-29** - `1.1.0` - introduced [campaigns api](#campaigns-api) and [products api](#products-api). +- **2016-12-15** - `1.0.0` - introduced namespaces, unified method names, updated README. Migration from versions 0.x required [migration from version 0.x](#migration-from-0x) +- **2016-12-02** - `0.8.2` - support gift vouchers in utils, fix price and discount calculations for amount discounts +- **2016-10-03** - `0.8.1` - publish update +- **2016-08-02** - `0.8.0` - validate voucher +- **2016-07-18** - `0.7.0` - voucher udpate +- **2016-07-05** - `0.6.0` - new utils module +- **2016-06-16** - `0.5.0` - unified naming convention +- **2016-06-12** - `0.4.0` - new customer sdk methods +- **2016-05-24** - `0.3.0` - new publish structure +- **2016-04-27** - `0.2.0` - rollback redemption +- **2016-04-13** - `0.1.3` - bugfix in redeem() +- **2016-04-13** - `0.1.2` - removed dependency to `pry` +- **2016-04-12** - `0.1.1` - minor gemspec changes +- **2016-04-12** - `0.1.0` - First version: + - Authentication + - Voucher information: *retrieve voucher*, *list vouchers*, *retrieve redemptions*, *list redemptions* + - Voucher operations: *redeem voucher*, *publish voucher*, *create voucher*, *enable/disable voucher* diff --git a/Dockerfile b/Dockerfile index 5fc0f6d1..738b6761 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app COPY . . RUN gem build VoucherifySdk.gemspec -RUN gem install voucherify-5.0.1.gem +RUN gem install voucherify-6.0.0.gem RUN gem install dotenv RUN gem install rspec diff --git a/ENDPOINTS-COVERAGE.md b/ENDPOINTS-COVERAGE.md index ce8cbd9d..7fab0d72 100644 --- a/ENDPOINTS-COVERAGE.md +++ b/ENDPOINTS-COVERAGE.md @@ -1,868 +1,352 @@ # Endpoints Coverage -# Table of Contents + +## Table of Content - [Publications](#publications) - - [/v1/publications/create](#v1publicationscreate) - - [/v1/publications](#v1publications) - [Qualifications](#qualifications) - - [/v1/qualifications](#v1qualifications) - [Validations](#validations) - - [/v1/validations](#v1validations) - - [/v1/vouchers/{code}/validate](#v1voucherscodevalidate-deprecated) - - [/v1/promotions/validation](#v1promotionsvalidation-deprecated) - - [/v1/promotions/tiers/{tierId}/validation](#v1promotionstierstieridvalidation-deprecated) - [Redemptions](#redemptions) - - [/v1/redemptions](#v1redemptions) - - [/v1/redemptions/{redemptionId}](#v1redemptionsredemptionid) - - [/v1/vouchers/{code}/redemption](#v1voucherscoderedemption) - - [/v1/redemptions/{redemptionId}/rollback](#v1redemptionsredemptionidrollback) - - [/v1/promotions/tiers/{promotionTierId}/redemption](#v1promotionstierspromotiontieridredemption-deprecated) - - [/v1/redemptions/{parentRedemptionId}/rollbacks](#v1redemptionsparentredemptionidrollbacks) - [Vouchers](#vouchers) - - [/v1/vouchers](#v1vouchers) - - [/v1/vouchers/{code}](#v1voucherscode) - - [/v1/vouchers/{code}/enable](#v1voucherscodeenable) - - [/v1/vouchers/{code}/disable](#v1voucherscodedisable) - - [/v1/vouchers/{code}/balance](#v1voucherscodebalance) - - [/v1/vouchers/{code}/transactions](#v1voucherscodetransactions) - - [/v1/vouchers/{code}/transactions/export](#v1voucherscodetransactionsexport) - - [/v1/vouchers/import](#v1vouchersimport) - - [/v1/vouchers/importCSV](#v1vouchersimportcsv) - - [/v1/vouchers/bulk/async](#v1vouchersbulkasync) - - [/v1/vouchers/metadata/async](#v1vouchersmetadataasync) - - [/v1/vouchers/{code}/sessions/{sessionKey}](#v1voucherscodesessionssessionkey) - - [/v1/vouchers/qualification](#v1vouchersqualification-deprecated) - [Campaigns](#campaigns) - - [/v1/campaigns](#v1campaigns) - - [/v1/campaigns/{campaignId}](#v1campaignscampaignid) - - [/v1/campaigns/{campaignId}/vouchers](#v1campaignscampaignidvouchers) - - [/v1/campaigns/{campaignId}/vouchers/{code}](#v1campaignscampaignidvoucherscode) - - [/v1/campaigns/{campaignId}/import](#v1campaignscampaignidimport) - - [/v1/campaigns/{campaignId}/importCSV](#v1campaignscampaignidimportcsv) - - [/v1/campaigns/qualification](#v1campaignsqualification-deprecated) - - [/v1/campaigns/{campaignId}/enable](#v1campaignscampaignidenable) - - [/v1/campaigns/{campaignId}/disable](#v1campaignscampaigniddisable) - [Promotions](#promotions) - - [/v1/promotions/tiers](#v1promotionstiers) - - [/v1/promotions/{campaignId}/tiers](#v1promotionscampaignidtiers) - - [/v1/promotions/tiers/{promotionTierId}](#v1promotionstierspromotiontierid) - - [/v1/promotions/tiers/{promotionTierId}/enable](#v1promotionstierspromotiontieridenable) - - [/v1/promotions/tiers/{promotionTierId}/disable](#v1promotionstierspromotiontieriddisable) - - [/v1/promotions/stacks](#v1promotionsstacks) - - [/v1/promotions/{campaignId}/stacks](#v1promotionscampaignidstacks) - - [/v1/promotions/{campaignId}/stacks/{stackId}](#v1promotionscampaignidstacksstackid) - [Rewards](#rewards) - - [/v1/rewards](#v1rewards) - - [/v1/rewards/{rewardId}](#v1rewardsrewardid) - - [/v1/rewards/{rewardId}/assignments](#v1rewardsrewardidassignments) - - [/v1/rewards/{rewardId}/assignments/{assignmentId}](#v1rewardsrewardidassignmentsassignmentid) - [Loyalties](#loyalties) - - [/v1/loyalties](#v1loyalties) - - [/v1/loyalties/{campaignId}](#v1loyaltiescampaignid) - - [/v1/loyalties/{campaignId}/members](#v1loyaltiescampaignidmembers) - - [/v1/loyalties/{campaignId}/members/{memberId}](#v1loyaltiescampaignidmembersmemberid) - - [/v1/loyalties/members/{memberId}](#v1loyaltiesmembersmemberid) - - [/v1/loyalties/{campaignId}/members/{memberId}/activities](#v1loyaltiescampaignidmembersmemberidactivities) - - [/v1/loyalties/members/{memberId}/activities](#v1loyaltiesmembersmemberidactivities) - - [/v1/loyalties/{campaignId}/members/{memberId}/balance](#v1loyaltiescampaignidmembersmemberidbalance) - - [/v1/loyalties/members/{memberId}/balance](#v1loyaltiesmembersmemberidbalance) - - [/v1/loyalties/{campaignId}/members/{memberId}/transfers](#v1loyaltiescampaignidmembersmemberidtransfers) - - [/v1/loyalties/{campaignId}/members/{memberId}/transactions](#v1loyaltiescampaignidmembersmemberidtransactions) - - [/v1/loyalties/members/{memberId}/transactions](#v1loyaltiesmembersmemberidtransactions) - - [/v1/loyalties/members/{memberId}/transactions/export](#v1loyaltiesmembersmemberidtransactionsexport) - - [/v1/loyalties/{campaignId}/members/{memberId}/transactions/export](#v1loyaltiescampaignidmembersmemberidtransactionsexport) - - [/v1/loyalties/{campaignId}/members/{memberId}/points-expiration](#v1loyaltiescampaignidmembersmemberidpoints-expiration) - - [/v1/loyalties/{campaignId}/points-expiration/export](#v1loyaltiescampaignidpoints-expirationexport) - - [/v1/loyalties/{campaignId}/earning-rules](#v1loyaltiescampaignidearning-rules) - - [/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}](#v1loyaltiescampaignidearning-rulesearningruleid) - - [/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable](#v1loyaltiescampaignidearning-rulesearningruleidenable) - - [/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable](#v1loyaltiescampaignidearning-rulesearningruleiddisable) - - [/v1/loyalties/members/{memberId}/rewards](#v1loyaltiesmembersmemberidrewards) - - [/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward](#v1loyaltiescampaignidreward-assignmentsassignmentidreward) - - [/v1/loyalties/{campaignId}/reward-assignments](#v1loyaltiescampaignidreward-assignments) - - [/v1/loyalties/{campaignId}/rewards](#v1loyaltiescampaignidrewards) - - [/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}](#v1loyaltiescampaignidreward-assignmentsassignmentid) - - [/v1/loyalties/{campaignId}/rewards/{assignmentId}](#v1loyaltiescampaignidrewardsassignmentid) - - [/v1/loyalties/{campaignId}/members/{memberId}/redemption](#v1loyaltiescampaignidmembersmemberidredemption) - - [/v1/loyalties/members/{memberId}/redemption](#v1loyaltiesmembersmemberidredemption) - - [/v1/loyalties/{campaignId}/tiers](#v1loyaltiescampaignidtiers) - - [/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}](#v1loyaltiescampaignidtiersloyaltytierid) - - [/v1/loyalties/members/{memberId}/tiers](#v1loyaltiesmembersmemberidtiers) - - [/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules](#v1loyaltiescampaignidtiersloyaltytieridearning-rules) - - [/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards](#v1loyaltiescampaignidtiersloyaltytieridrewards) - [Customers](#customers) - - [/v1/customers](#v1customers) - - [/v1/customers/{customerId}](#v1customerscustomerid) - - [/v1/customers/{customerId}/permanent-deletion](#v1customerscustomeridpermanent-deletion) - - [/v1/customers/importCSV](#v1customersimportcsv) - - [/v1/customers/bulk/async](#v1customersbulkasync) - - [/v1/customers/metadata/async](#v1customersmetadataasync) - - [/v1/customers/{customerId}/consents](#v1customerscustomeridconsents) - - [/v1/customers/{customerId}/activities](#v1customerscustomeridactivities) - - [/v1/customers/{customerId}/segments](#v1customerscustomeridsegments) - [Orders](#orders) - - [/v1/orders](#v1orders) - - [/v1/orders/{orderId}](#v1ordersorderid) - - [/v1/orders/import](#v1ordersimport) - - [/v1/orders/export](#v1ordersexport) - [Products](#products) - - [/v1/products](#v1products) - - [/v1/products/{productId}](#v1productsproductid) - - [/v1/products/bulk/async](#v1productsbulkasync) - - [/v1/products/metadata/async](#v1productsmetadataasync) - - [/v1/skus/{skuId}](#v1skusskuid) - - [/v1/products/{productId}/skus](#v1productsproductidskus) - - [/v1/products/{productId}/skus/{skuId}](#v1productsproductidskusskuid) - - [/v1/products/importCSV](#v1productsimportcsv) - - [/v1/skus/importCSV](#v1skusimportcsv) -- [Product Collections](#product collections) - - [/v1/product-collections](#v1product-collections) - - [/v1/product-collections/{productCollectionId}](#v1product-collectionsproductcollectionid) - - [/v1/product-collections/{productCollectionId}/products](#v1product-collectionsproductcollectionidproducts) -- [Validation Rules](#validation rules) - - [/v1/validation-rules](#v1validation-rules) - - [/v1/validation-rules/{validationRuleId}](#v1validation-rulesvalidationruleid) - - [/v1/validation-rules-assignments](#v1validation-rules-assignments) - - [/v1/validation-rules/{validationRuleId}/assignments](#v1validation-rulesvalidationruleidassignments) - - [/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}](#v1validation-rulesvalidationruleidassignmentsassignmentid) +- [Product Collections](#product-collections) +- [Validation Rules](#validation-rules) - [Segments](#segments) - - [/v1/segments/{segmentId}](#v1segmentssegmentid) - - [/v1/segments](#v1segments) - [Events](#events) - - [/v1/events](#v1events) - [Consents](#consents) - - [/v1/consents](#v1consents) -- [Async Actions](#async actions) - - [/v1/async-actions](#v1async-actions) - - [/v1/async-actions/{asyncActionId}](#v1async-actionsasyncactionid) +- [Async Actions](#async-actions) - [Exports](#exports) - - [/v1/exports](#v1exports) - - [/v1/exports/{exportId}](#v1exportsexportid) - - [/v1/exports/{export_Id}](#v1exportsexport_id) - [Categories](#categories) - - [/v1/categories](#v1categories) - - [/v1/categories/{categoryId}](#v1categoriescategoryid) -- [Metadata Schemas](#metadata schemas) - - [/v1/metadata-schemas](#v1metadata-schemas) - - [/v1/metadata-schemas/{resource}](#v1metadata-schemasresource) +- [Metadata Schemas](#metadata-schemas) - [Locations](#locations) - - [/v1/locations](#v1locations) - - [/v1/locations/{locationId}](#v1locationslocationid) +- [Referrals](#referrals) +- [Bin](#bin) +- [Templates](#templates) +- [Management](#management) - [Client-side](#client-side) - - [/client/v1/qualifications](#clientv1qualifications) - - [/client/v1/promotions/tiers](#clientv1promotionstiers) - - [/client/v1/redemptions](#clientv1redemptions) - - [/client/v1/validations](#clientv1validations) - - [/client/v1/customers/{customerId}/consents](#clientv1customerscustomeridconsents) - - [/client/v1/events](#clientv1events) - - [/client/v1/consents](#clientv1consents) - - [/client/v1/validate](#clientv1validate-deprecated) - - [/client/v1/redeem](#clientv1redeem-deprecated) # Endpoints ## Publications -### /v1/publications/create -#### Create Publication (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/publications -#### List Publications (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/publications_list_response_body.rb) ✅ -#### Create Publication (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/publications_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/publications_create_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/publications/create | get | Create Publication | supported | | +| /v1/publications | get | List Publications | supported | | +| /v1/publications | post | Create Publication | supported | | ## Qualifications -### /v1/qualifications -#### Check Eligibility (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/qualifications_check_eligibility_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/qualifications_check_eligibility_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------ | ------ | ----------------- | ------------------------------------ | ------------- | +| /v1/qualifications | post | Check Eligibility | supported | | ## Validations -### /v1/validations -#### Validate Stackable Discounts (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/validations_validate_response_body.rb) ✅ -- **ResponseSupported:** ❌ -### ~~❗/v1/vouchers/{code}/validate [Deprecated]❗~~ -#### ~~❗Validate Voucher [Deprecated] (post)❗~~ -### ~~❗/v1/promotions/validation [Deprecated]❗~~ -#### ~~❗Validate Promotions [Deprecated] (post)❗~~ -### ~~❗/v1/promotions/tiers/{tierId}/validation [Deprecated]❗~~ -#### ~~❗Validate Promotion Tier [Deprecated] (post)❗~~ +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------- | ------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/validations | post | Validate Stackable Discounts | supported | | +| /v1/vouchers/{code}/validate | post | Validate Voucher [Deprecated] | | deprecated | +| /v1/promotions/validation | post | Validate Promotions [Deprecated] | | deprecated | +| /v1/promotions/tiers/{tierId}/validation | post | Validate Promotion Tier [Deprecated] | | deprecated | ## Redemptions -### /v1/redemptions -#### List Redemptions (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/redemptions_list_response_body.rb) ✅ -#### Redeem Stackable Discounts (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/redemptions_redeem_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/redemptions_redeem_response_body.rb) ✅ -### /v1/redemptions/{redemptionId} -#### Get Redemption (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/redemptions_get_response_body.rb) ✅ -### /v1/vouchers/{code}/redemption -#### Get Voucher's Redemptions (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_redemption_get_response_body.rb) ✅ -#### ~~❗Redeem Voucher [Deprecated] (post)❗~~ -### /v1/redemptions/{redemptionId}/rollback -#### Rollback Redemption (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/redemptions_rollback_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/redemptions_rollback_create_response_body.rb) ✅ -### ~~❗/v1/promotions/tiers/{promotionTierId}/redemption [Deprecated]❗~~ -#### ~~❗Redeem Promotion [Deprecated] (post)❗~~ -### /v1/redemptions/{parentRedemptionId}/rollbacks -#### Rollback Stackable Redemptions (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/redemptions_rollbacks_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/redemptions_rollbacks_create_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------- | ------ | ------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/redemptions | get | List Redemptions | supported | | +| /v1/redemptions | post | Redeem Stackable Discounts | supported | | +| /v1/redemptions/{redemptionId} | get | Get Redemption | supported | | +| /v1/vouchers/{code}/redemption | get | Get Voucher's Redemptions | supported | | +| /v1/vouchers/{code}/redemption | post | Redeem Voucher [Deprecated] | | deprecated | +| /v1/redemptions/{redemptionId}/rollback | post | Rollback Redemption | supported | | +| /v1/promotions/tiers/{promotionTierId}/redemption | post | Redeem Promotion [Deprecated] | | deprecated | +| /v1/redemptions/{parentRedemptionId}/rollbacks | post | Rollback Stackable Redemptions | supported | | ## Vouchers -### /v1/vouchers -#### List Vouchers (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Generate Random Code (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/vouchers/{code} -#### Get Voucher (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_get_response_body.rb) ✅ -#### Update Voucher (put) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -#### Delete Voucher (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -#### Create Voucher (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/vouchers/{code}/enable -#### Enable Voucher (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_enable_response_body.rb) ✅ -### /v1/vouchers/{code}/disable -#### Disable Voucher (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_disable_response_body.rb) ✅ -### /v1/vouchers/{code}/balance -#### Add or Remove Voucher Balance (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/vouchers_balance_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_balance_update_response_body.rb) ✅ -### /v1/vouchers/{code}/transactions -#### List Voucher Transactions (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_transactions_list_response_body.rb) ✅ -### /v1/vouchers/{code}/transactions/export -#### Export Voucher Transactions (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/vouchers_transactions_export_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_transactions_export_create_response_body.rb) ✅ -### /v1/vouchers/import -#### Import Vouchers (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/vouchers/importCSV -#### Import Vouchers using CSV (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/vouchers_import_csv_create_response_body.rb) ✅ -### /v1/vouchers/bulk/async -#### Update Vouchers in bulk (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/vouchers/metadata/async -#### Update Vouchers' metadata in bulk (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/vouchers/{code}/sessions/{sessionKey} -#### Release Validation Session (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### ~~❗/v1/vouchers/qualification [Deprecated]❗~~ -#### ~~❗Examine Qualification [Deprecated] (post)❗~~ +| endpoint | method | summary | is supported | is deprecated | +| ----------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------------------------------ | +| /v1/vouchers | get | List Vouchers | supported | | +| /v1/vouchers | post | Generate Random Code | supported | | +| /v1/vouchers/{code} | get | Get Voucher | supported | | +| /v1/vouchers/{code} | put | Update Voucher | supported | | +| /v1/vouchers/{code} | delete | Delete Voucher | supported | | +| /v1/vouchers/{code} | post | Create Voucher | supported | | +| /v1/vouchers/{code}/enable | post | Enable Voucher | supported | | +| /v1/vouchers/{code}/disable | post | Disable Voucher | supported | | +| /v1/vouchers/{code}/balance | post | Add or Remove Voucher Balance | supported | | +| /v1/vouchers/{code}/transactions | get | List Voucher Transactions | supported | | +| /v1/vouchers/{code}/transactions/export | post | Export Voucher Transactions | supported | | +| /v1/vouchers/import | post | Import Vouchers | supported | | +| /v1/vouchers/importCSV | post | Import Vouchers using CSV | supported | | +| /v1/vouchers/bulk/async | post | Update Vouchers in Bulk | supported | | +| /v1/vouchers/metadata/async | post | Update Vouchers' Metadata in Bulk | supported | | +| /v1/vouchers/{code}/sessions/{sessionKey} | delete | Release Validation Session | supported | | +| /v1/vouchers/qualification | post | Examine Qualification [Deprecated] | | deprecated | ## Campaigns -### /v1/campaigns -#### Create Campaign (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/campaigns_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_create_response_body.rb) ✅ -#### List Campaigns (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_list_response_body.rb) ✅ -### /v1/campaigns/{campaignId} -#### Get Campaign (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_get_response_body.rb) ✅ -#### Update Campaign (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/campaigns_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_update_response_body.rb) ✅ -#### Delete Campaign (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_delete_response_body.rb) ✅ -### /v1/campaigns/{campaignId}/vouchers -#### Add Vouchers to Campaign (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/campaigns_vouchers_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_vouchers_create_response_body.rb) ✅ -### /v1/campaigns/{campaignId}/vouchers/{code} -#### Add Voucher with Specific Code to Campaign (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/campaigns_vouchers_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_vouchers_create_response_body.rb) ✅ -### /v1/campaigns/{campaignId}/import -#### Import Vouchers to Campaign (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/campaigns_import_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_import_create_response_body.rb) ✅ -### /v1/campaigns/{campaignId}/importCSV -#### Import Vouchers to Campaign by CSV (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_import_csv_create_response_body.rb) ✅ -### ~~❗/v1/campaigns/qualification [Deprecated]❗~~ -#### ~~❗Examine Qualification [Deprecated] (post)❗~~ -### /v1/campaigns/{campaignId}/enable -#### Enable Campaign (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_enable_response_body.rb) ✅ -### /v1/campaigns/{campaignId}/disable -#### Disable Campaign (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/campaigns_disable_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------ | ------ | ------------------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/campaigns | post | Create Campaign | supported | | +| /v1/campaigns | get | List Campaigns | supported | | +| /v1/campaigns/{campaignId} | get | Get Campaign | supported | | +| /v1/campaigns/{campaignId} | put | Update Campaign | supported | | +| /v1/campaigns/{campaignId} | delete | Delete Campaign | supported | | +| /v1/campaigns/{campaignId}/vouchers | post | Add Vouchers to Campaign | supported | | +| /v1/campaigns/{campaignId}/vouchers/{code} | post | Add Voucher with Specific Code to Campaign | supported | | +| /v1/campaigns/{campaignId}/import | post | Import Vouchers to Campaign | supported | | +| /v1/campaigns/{campaignId}/importCSV | post | Import Vouchers to Campaign by CSV | supported | | +| /v1/campaigns/qualification | post | Examine Qualification [Deprecated] | | deprecated | +| /v1/campaigns/{campaignId}/enable | post | Enable Campaign | supported | | +| /v1/campaigns/{campaignId}/disable | post | Disable Campaign | supported | | ## Promotions -### /v1/promotions/tiers -#### List Promotion Tiers (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/promotions/{campaignId}/tiers -#### List Promotion Tiers from Campaign (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_tiers_list_response_body.rb) ✅ -#### Add Promotion Tier to Campaign (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/promotions/tiers/{promotionTierId} -#### Get Promotion Tier (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_tiers_get_response_body.rb) ✅ -#### Update Promotion Tier (put) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -#### Delete Promotion Tier (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/promotions/tiers/{promotionTierId}/enable -#### Enable Promotion Tier (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_tiers_enable_response_body.rb) ✅ -### /v1/promotions/tiers/{promotionTierId}/disable -#### Disable Promotion Tier (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_tiers_disable_response_body.rb) ✅ -### /v1/promotions/stacks -#### List Promotion Stacks (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_list_response_body.rb) ✅ -### /v1/promotions/{campaignId}/stacks -#### List Promotion Stacks in Campaign (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_list_response_body.rb) ✅ -#### Create Promotion Stack (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_create_response_body.rb) ✅ -### /v1/promotions/{campaignId}/stacks/{stackId} -#### Get Promotion Stack (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_get_response_body.rb) ✅ -#### Update Promotion Stack (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/promotions_stacks_update_response_body.rb) ✅ -#### Delete Promotion Stack (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------- | +| /v1/promotions/tiers | get | List Promotion Tiers | supported | | +| /v1/promotions/{campaignId}/tiers | get | List Promotion Tiers from Campaign | supported | | +| /v1/promotions/{campaignId}/tiers | post | Add Promotion Tier to Campaign | supported | | +| /v1/promotions/tiers/{promotionTierId} | get | Get Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId} | put | Update Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId} | delete | Delete Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId}/enable | post | Enable Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId}/disable | post | Disable Promotion Tier | supported | | +| /v1/promotions/stacks | get | List Promotion Stacks | supported | | +| /v1/promotions/{campaignId}/stacks | get | List Promotion Stacks in Campaign | supported | | +| /v1/promotions/{campaignId}/stacks | post | Create Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | get | Get Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | put | Update Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | delete | Delete Promotion Stack | supported | | ## Rewards -### /v1/rewards -#### List Rewards (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Create Reward (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/rewards/{rewardId} -#### Get Reward (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Update Reward (put) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -#### Delete Reward (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/rewards/{rewardId}/assignments -#### List Reward Assignments (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/rewards_assignments_list_response_body.rb) ✅ -#### Create Reward Assignment (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/rewards_assignments_create_response_body.rb) ✅ -- **ResponseSupported:** ❌ -### /v1/rewards/{rewardId}/assignments/{assignmentId} -#### Update Reward Assignment (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/rewards_assignments_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/rewards_assignments_update_response_body.rb) ✅ -#### Delete Reward Assignment (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -#### Get Reward Assignment (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/rewards_assignments_get_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------- | ------ | ------------------------ | ------------------------------------ | ------------- | +| /v1/rewards | get | List Rewards | supported | | +| /v1/rewards | post | Create Reward | supported | | +| /v1/rewards/{rewardId} | get | Get Reward | supported | | +| /v1/rewards/{rewardId} | put | Update Reward | supported | | +| /v1/rewards/{rewardId} | delete | Delete Reward | supported | | +| /v1/rewards/{rewardId}/assignments | get | List Reward Assignments | supported | | +| /v1/rewards/{rewardId}/assignments | post | Create Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | put | Update Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | delete | Delete Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | get | Get Reward Assignment | supported | | ## Loyalties -### /v1/loyalties -#### List Loyalty Campaigns (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Create Loyalty Campaign (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId} -#### Get Loyalty Campaign (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Update Loyalty Campaign (put) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -#### Delete Loyalty Campaign (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_delete_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/members -#### List Members (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Add Member (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId}/members/{memberId} -#### Get Member (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/loyalties/members/{memberId} -#### Get Member (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId}/members/{memberId}/activities -#### Get Member Activities (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/loyalties/members/{memberId}/activities -#### Get Member Activities (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId}/members/{memberId}/balance -#### Add or Remove Loyalty Card Balance (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_balance_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_balance_update_response_body.rb) ✅ -### /v1/loyalties/members/{memberId}/balance -#### Add or Remove Loyalty Card Balance (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_balance_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_balance_update_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/members/{memberId}/transfers -#### Transfer Loyalty Points (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transfers_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transfers_create_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/members/{memberId}/transactions -#### List Loyalty Card Transactions (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transactions_list_response_body.rb) ✅ -### /v1/loyalties/members/{memberId}/transactions -#### List Loyalty Card Transactions (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transactions_list_response_body.rb) ✅ -### /v1/loyalties/members/{memberId}/transactions/export -#### Export Loyalty Card Transactions (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transactions_export_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transactions_export_create_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/members/{memberId}/transactions/export -#### Export Loyalty Card Transactions (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transactions_export_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_transactions_export_create_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/members/{memberId}/points-expiration -#### Get Points Expiration (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_points_expiration_list_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/points-expiration/export -#### Create Points Expiration Export (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId}/earning-rules -#### List Earning Rules (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Create Earning Rule (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** *Not applicable* -### /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} -#### Get Earning Rule (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_earning_rules_get_response_body.rb) ✅ -#### Update Earning Rule (put) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -#### Delete Earning Rule (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable -#### Enable Earning Rule (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_earning_rules_enable_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable -#### Disable Earning Rule (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_earning_rules_disable_response_body.rb) ✅ -### /v1/loyalties/members/{memberId}/rewards -#### List Member Rewards (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_rewards_list_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward -#### Get Reward Details (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_reward_assignments_reward_get_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/reward-assignments -#### List Reward Assignments (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId}/rewards -#### List Reward Assignments (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Create Reward Assignment (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} -#### Get Reward Assignment (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_reward_assignments_get_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/rewards/{assignmentId} -#### Get Reward Assignment (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_rewards_get_response_body.rb) ✅ -#### Update Reward Assignment (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/4_obj_reward_assignment_object.rb) ✅ -- **ResponseSupported:** ❌ -#### Delete Reward Assignment (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/loyalties/{campaignId}/members/{memberId}/redemption -#### Redeem Reward (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_redemption_redeem_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_redemption_redeem_response_body.rb) ✅ -### /v1/loyalties/members/{memberId}/redemption -#### Redeem Reward (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_redemption_redeem_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_redemption_redeem_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/tiers -#### List Loyalty Tiers (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_tiers_list_response_body.rb) ✅ -#### Create loyalty tiers (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/loyalties_tiers_create_in_bulk_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_tiers_create_in_bulk_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} -#### Get Loyalty Tier (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_tiers_get_response_body.rb) ✅ -### /v1/loyalties/members/{memberId}/tiers -#### List Member's Loyalty Tiers (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_members_tiers_list_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules -#### List Loyalty Tier Earning Rules (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_tiers_earning_rules_list_response_body.rb) ✅ -### /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards -#### List Loyalty Tier Rewards (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/loyalties_tiers_rewards_list_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------- | +| /v1/loyalties | get | List Loyalty Campaigns | supported | | +| /v1/loyalties | post | Create Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | get | Get Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | put | Update Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | delete | Delete Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId}/members | get | List Members | supported | | +| /v1/loyalties/{campaignId}/members | post | Add Member | supported | | +| /v1/loyalties/{campaignId}/members/{memberId} | get | Get Member | supported | | +| /v1/loyalties/members/{memberId} | get | Get Member | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/activity | get | List Member Activity | supported | | +| /v1/loyalties/members/{memberId}/activity | get | List Member Activity | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/balance | post | Add or Remove Loyalty Card Balance | supported | | +| /v1/loyalties/members/{memberId}/balance | post | Add or Remove Loyalty Card Balance | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transfers | post | Transfer Loyalty Points | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transactions | get | List Loyalty Card Transactions | supported | | +| /v1/loyalties/members/{memberId}/transactions | get | List Loyalty Card Transactions | supported | | +| /v1/loyalties/members/{memberId}/transactions/export | post | Export Loyalty Card Transactions | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | post | Export Loyalty Card Transactions | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | get | Get Points Expiration | supported | | +| /v1/loyalties/{campaignId}/points-expiration/export | post | Create Points Expiration Export | supported | | +| /v1/loyalties/{campaignId}/earning-rules | get | List Earning Rules | supported | | +| /v1/loyalties/{campaignId}/earning-rules | post | Create Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | get | Get Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | put | Update Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | delete | Delete Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | post | Enable Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | post | Disable Earning Rule | supported | | +| /v1/loyalties/members/{memberId}/rewards | get | List Member Rewards | supported | | +| /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | get | Get Reward Details | supported | | +| /v1/loyalties/{campaignId}/reward-assignments | get | List Reward Assignments | supported | | +| /v1/loyalties/{campaignId}/rewards | get | List Reward Assignments | supported | | +| /v1/loyalties/{campaignId}/rewards | post | Create Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | get | Get Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | get | Get Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | put | Update Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | delete | Delete Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/redemption | post | Redeem Reward | supported | | +| /v1/loyalties/members/{memberId}/redemption | post | Redeem Reward | supported | | +| /v1/loyalties/{campaignId}/tiers | get | List Loyalty Tiers | supported | | +| /v1/loyalties/{campaignId}/tiers | post | Create loyalty tiers | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | get | Get Loyalty Tier | supported | | +| /v1/loyalties/members/{memberId}/tiers | get | List Member's Loyalty Tiers | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | get | List Loyalty Tier Earning Rules | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | get | List Loyalty Tier Rewards | supported | | ## Customers -### /v1/customers -#### List Customers (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_list_response_body.rb) ✅ -#### Create Customer (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/customers_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_create_response_body.rb) ✅ -### /v1/customers/{customerId} -#### Get Customer (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_get_response_body.rb) ✅ -#### Delete Customer (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -#### Update Customer (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/customers_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_update_response_body.rb) ✅ -### /v1/customers/{customerId}/permanent-deletion -#### Delete Customer Permanently (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_permanent_deletion_create_response_body.rb) ✅ -### /v1/customers/importCSV -#### Import and Update Customers using CSV (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_import_csv_create_response_body.rb) ✅ -### /v1/customers/bulk/async -#### Update Customers in bulk (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_update_in_bulk_response_body.rb) ✅ -### /v1/customers/metadata/async -#### Update Customers' Metadata in bulk (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/customers_metadata_update_in_bulk_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_metadata_update_in_bulk_response_body.rb) ✅ -### /v1/customers/{customerId}/consents -#### Update Customer's consents (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/.rb) ✅ -- **ResponseSupported:** *Not applicable* -### /v1/customers/{customerId}/activities -#### List Customer Activities (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_activities_list_response_body.rb) ✅ -### /v1/customers/{customerId}/segments -#### List Customer's Segments (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/customers_segments_list_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| --------------------------------------------- | ------ | --------------------------------------- | ------------------------------------ | ------------------------------------ | +| /v1/customers | get | List Customers | supported | | +| /v1/customers | post | Create Customer | supported | | +| /v1/customers/{customerId} | get | Get Customer | supported | | +| /v1/customers/{customerId} | delete | Delete Customer | supported | | +| /v1/customers/{customerId} | put | Update Customer | supported | | +| /v1/customers/{customerId}/permanent-deletion | post | Delete Customer Permanently | supported | | +| /v1/customers/importCSV | post | Import and Update Customers using CSV | supported | | +| /v1/customers/bulk/async | post | Update Customers in Bulk | supported | | +| /v1/customers/metadata/async | post | Update Customers' Metadata in Bulk | supported | | +| /v1/customers/{customerId}/consents | put | Update Customer's consents [Deprecated] | supported | deprecated | +| /v1/customers/{customerId}/activity | get | List Customer Activity | supported | | +| /v1/customers/{customerId}/activities | get | List Customer Activities [Deprecated] | supported | deprecated | +| /v1/customers/{customerId}/segments | get | List Customer's Segments | supported | | +| /v1/customers/{customerId}/redeemables | get | List Customer's Redeemables | supported | | ## Orders -### /v1/orders -#### List Orders (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/orders_list_response_body.rb) ✅ -#### Create Order (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/orders_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/orders_create_response_body.rb) ✅ -### /v1/orders/{orderId} -#### Get Order (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/orders_get_response_body.rb) ✅ -#### Update Order (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/orders_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/orders_update_response_body.rb) ✅ -### /v1/orders/import -#### Import Orders (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/orders_import_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/orders_import_create_response_body.rb) ✅ -### /v1/orders/export -#### Create Orders Export (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/orders_export_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/orders_export_create_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| -------------------- | ------ | -------------------- | ------------------------------------ | ------------- | +| /v1/orders | get | List Orders | supported | | +| /v1/orders | post | Create Order | supported | | +| /v1/orders/{orderId} | get | Get Order | supported | | +| /v1/orders/{orderId} | put | Update Order | supported | | +| /v1/orders/import | post | Import Orders | supported | | +| /v1/orders/export | post | Create Orders Export | supported | | ## Products -### /v1/products -#### List Products (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_list_response_body.rb) ✅ -#### Create Product (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/products_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_create_response_body.rb) ✅ -### /v1/products/{productId} -#### Get Product (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_get_response_body.rb) ✅ -#### Update Product (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/products_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_update_response_body.rb) ✅ -#### Delete Product (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/products/bulk/async -#### Update Products in bulk (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_update_in_bulk_response_body.rb) ✅ -### /v1/products/metadata/async -#### Update Products' Metadata in bulk (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/products_metadata_update_in_bulk_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_metadata_update_in_bulk_response_body.rb) ✅ -### /v1/skus/{skuId} -#### Get SKU (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/skus_get_response_body.rb) ✅ -### /v1/products/{productId}/skus -#### List SKUs in Product (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_skus_list_response_body.rb) ✅ -#### Create SKU (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/products_skus_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_skus_create_response_body.rb) ✅ -### /v1/products/{productId}/skus/{skuId} -#### Update SKU (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/products_skus_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_skus_update_response_body.rb) ✅ -#### Delete SKU (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/products/importCSV -#### Import Products using CSV (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/products_import_csv_create_response_body.rb) ✅ -### /v1/skus/importCSV -#### Import SKUs using CSV (post) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/skus_import_csv_create_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------- | ------ | --------------------------------- | ------------------------------------ | ------------- | +| /v1/products | get | List Products | supported | | +| /v1/products | post | Create Product | supported | | +| /v1/products/{productId} | get | Get Product | supported | | +| /v1/products/{productId} | put | Update Product | supported | | +| /v1/products/{productId} | delete | Delete Product | supported | | +| /v1/products/bulk/async | post | Update Products in Bulk | supported | | +| /v1/products/metadata/async | post | Update Products' Metadata in Bulk | supported | | +| /v1/skus/{skuId} | get | Get SKU | supported | | +| /v1/products/{productId}/skus | get | List SKUs in Product | supported | | +| /v1/products/{productId}/skus | post | Create SKU | supported | | +| /v1/products/{productId}/skus/{skuId} | put | Update SKU | supported | | +| /v1/products/{productId}/skus/{skuId} | delete | Delete SKU | supported | | +| /v1/products/importCSV | post | Import Products using CSV | supported | | +| /v1/skus/importCSV | post | Import SKUs using CSV | supported | | ## Product Collections -### /v1/product-collections -#### List Product Collections (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/product_collections_list_response_body.rb) ✅ -#### Create Product Collection (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/product_collections_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/product_collections_create_response_body.rb) ✅ -### /v1/product-collections/{productCollectionId} -#### Get Product Collection (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/product_collections_get_response_body.rb) ✅ -#### Delete Product Collection (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/product-collections/{productCollectionId}/products -#### List Products in Collection (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/product_collections_products_list_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------ | ------ | --------------------------- | ------------------------------------ | ------------- | +| /v1/product-collections | get | List Product Collections | supported | | +| /v1/product-collections | post | Create Product Collection | supported | | +| /v1/product-collections/{productCollectionId} | get | Get Product Collection | supported | | +| /v1/product-collections/{productCollectionId} | delete | Delete Product Collection | supported | | +| /v1/product-collections/{productCollectionId}/products | get | List Products in Collection | supported | | ## Validation Rules -### /v1/validation-rules -#### List Validation Rules (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/validation_rules_list_response_body.rb) ✅ -#### Create Validation Rules (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/validation_rules_create_response_body.rb) ✅ -- **ResponseSupported:** ❌ -### /v1/validation-rules/{validationRuleId} -#### Get Validation Rule (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/validation_rules_get_response_body.rb) ✅ -#### Update Validation Rule (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/validation_rules_update_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/validation_rules_update_response_body.rb) ✅ -#### Delete Validation Rule (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/validation-rules-assignments -#### List Validation Rules' Assignment(s) (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/validation_rules_assignments_list_response_body.rb) ✅ -### /v1/validation-rules/{validationRuleId}/assignments -#### List Validation Rule Assignments (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/validation_rules_assignments_list_response_body.rb) ✅ -#### Create Validation Rules Assignments (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ -### /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} -#### Delete Validation Rule Assignment (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------ | ------ | ------------------------------------ | ------------------------------------ | ------------- | +| /v1/validation-rules | get | List Validation Rules | supported | | +| /v1/validation-rules | post | Create Validation Rules | supported | | +| /v1/validation-rules/{validationRuleId} | get | Get Validation Rule | supported | | +| /v1/validation-rules/{validationRuleId} | put | Update Validation Rule | supported | | +| /v1/validation-rules/{validationRuleId} | delete | Delete Validation Rule | supported | | +| /v1/validation-rules-assignments | get | List Validation Rules' Assignment(s) | supported | | +| /v1/validation-rules/{validationRuleId}/assignments | get | List Validation Rule Assignments | supported | | +| /v1/validation-rules/{validationRuleId}/assignments | post | Create Validation Rules Assignments | supported | | +| /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | delete | Delete Validation Rule Assignment | supported | | ## Segments -### /v1/segments/{segmentId} -#### Get Segment (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -#### Delete Segment (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/segments -#### Create Segment (post) -- **RequestSupported:** ❌ -- **ResponseSupported:** ❌ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------ | ------ | -------------- | ------------------------------------ | ------------- | +| /v1/segments/{segmentId} | get | Get Segment | supported | | +| /v1/segments/{segmentId} | delete | Delete Segment | supported | | +| /v1/segments | post | Create Segment | supported | | ## Events -### /v1/events -#### Track Custom Event (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/events_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/events_create_response_body.rb) ✅ +| endpoint | method | summary | is supported | is deprecated | +| ---------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/events | post | Track Custom Event | supported | | ## Consents -### /v1/consents -#### List Consents (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ +| endpoint | method | summary | is supported | is deprecated | +| ------------ | ------ | -------------------------- | ------------ | ------------------------------------ | +| /v1/consents | get | List Consents [Deprecated] | | deprecated | ## Async Actions -### /v1/async-actions -#### List Async Actions (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/async-actions/{asyncActionId} -#### Get Async Action (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ +| endpoint | method | summary | is supported | is deprecated | +| --------------------------------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/async-actions | get | List Async Actions | supported | | +| /v1/async-actions/{asyncActionId} | get | Get Async Action | supported | | ## Exports -### /v1/exports -#### Create Export (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/exports_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/exports_create_response_body.rb) ✅ -#### List Exports (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/exports_list_response_body.rb) ✅ -### /v1/exports/{exportId} -#### Get Export (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/exports_get_response_body.rb) ✅ -#### Delete Export (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -### /v1/exports/{export_Id} -#### Download Export (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | --------------- | ------------------------------------ | ------------- | +| /v1/exports | post | Create Export | supported | | +| /v1/exports | get | List Exports | supported | | +| /v1/exports/{exportId} | get | Get Export | supported | | +| /v1/exports/{exportId} | delete | Delete Export | supported | | +| /v1/exports/{export_Id} | get | Download Export | supported | | ## Categories -### /v1/categories -#### List Categories (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/categories_list_response_body.rb) ✅ -#### Create Category (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/categories_create_response_body.rb) ✅ -- **ResponseSupported:** ❌ -### /v1/categories/{categoryId} -#### Get Category (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/categories_get_response_body.rb) ✅ -#### Delete Category (delete) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** *Not applicable* -#### Update Category (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/categories_update_response_body.rb) ✅ -- **ResponseSupported:** ❌ +| endpoint | method | summary | is supported | is deprecated | +| --------------------------- | ------ | --------------- | ------------------------------------ | ------------- | +| /v1/categories | get | List Categories | supported | | +| /v1/categories | post | Create Category | supported | | +| /v1/categories/{categoryId} | get | Get Category | supported | | +| /v1/categories/{categoryId} | delete | Delete Category | supported | | +| /v1/categories/{categoryId} | put | Update Category | supported | | ## Metadata Schemas -### /v1/metadata-schemas -#### List Metadata Schemas (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/metadata-schemas/{resource} -#### Get Metadata Schema (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------- | ------ | --------------------- | ------------ | ------------- | +| /v1/metadata-schemas | get | List Metadata Schemas | | | +| /v1/metadata-schemas/{resource} | get | Get Metadata Schema | | | ## Locations -### /v1/locations -#### List Locations (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /v1/locations/{locationId} -#### Get Location (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ +| endpoint | method | summary | is supported | is deprecated | +| -------------------------- | ------ | -------------- | ------------ | ------------- | +| /v1/locations | get | List Locations | | | +| /v1/locations/{locationId} | get | Get Location | | | +## Referrals +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------------------------------- | ------ | --------------------------- | ------------ | ------------- | +| /v1/referrals/{campaignId}/members/{memberId}/holders | post | Add Referral Code Holders | | | +| /v1/referrals/{campaignId}/members/{memberId}/holders | get | List Referral Code Holders | | | +| /v1/referrals/{campaignId}/members/{memberId}/holders/{holderId} | delete | Remove Referral Card Holder | | | +| /v1/referrals/members/{memberId}/holders | post | Add Referral Code Holders | | | +| /v1/referrals/members/{memberId}/holders | get | List Referral Code Holders | | | +| /v1/referrals/members/{memberId}/holders/{holderId} | delete | Remove Referral Card Holder | | | +## Bin +| endpoint | method | summary | is supported | is deprecated | +| -------------------------- | ------ | ---------------- | ------------ | ------------- | +| /v1/trash-bin | get | List Bin Entries | | | +| /v1/trash-bin/{binEntryId} | delete | Delete Bin Entry | | | +## Templates +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | ------------------------ | ------------ | ------------- | +| /v1/templates/campaigns | get | List Campaign Templates | | | +| /v1/templates/campaigns | post | Create Campaign Template | | | +## Management +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------------------ | ------ | -------------------------- | ------------ | ------------- | +| /management/v1/projects | post | Create Project | | | +| /management/v1/projects | get | List Projects | | | +| /management/v1/projects/{projectId} | get | Get Project | | | +| /management/v1/projects/{projectId} | put | Update Project | | | +| /management/v1/projects/{projectId} | delete | Delete Project | | | +| /management/v1/projects/{projectId}/users | post | Assign User | | | +| /management/v1/projects/{projectId}/users | get | List Users | | | +| /management/v1/projects/{projectId}/users/{userId} | get | Get User | | | +| /management/v1/projects/{projectId}/users/{userId} | put | Update User | | | +| /management/v1/projects/{projectId}/users/{userId} | delete | Unassign User | | | +| /management/v1/projects/users/invite | post | Invite a New User | | | +| /management/v1/projects/{projectId}/stacking-rules | post | Create Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules | get | List Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | get | Get Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | put | Update Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | delete | Delete Stacking Rules | | | +| /management/v1/projects/{projectId}/metadata-schemas | post | Create Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas | get | List Metadata Schemas | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | get | Get Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | put | Update Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | delete | Delete Metadata Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas | post | Create Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas | get | List Custom Event Schemas | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | get | Get Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | put | Update Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | delete | Delete Custom Event Schema | | | +| /management/v1/projects/{projectId}/webhooks | post | Create Webhook | | | +| /management/v1/projects/{projectId}/webhooks | get | List Webhooks | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | get | Get Webhook | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | put | Update Webhook | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | delete | Delete Webhook | | | +| /management/v1/projects/{projectId}/branding | post | Create Brand | | | +| /management/v1/projects/{projectId}/branding | get | List Brands | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | get | Get Brand | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | put | Update Brand | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | delete | Delete Brand | | | ## Client-side -### /client/v1/qualifications -#### Check Eligibility (client-side) (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/client_qualifications_check_eligibility_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/client_qualifications_check_eligibility_response_body.rb) ✅ -### /client/v1/promotions/tiers -#### List Promotion Tiers (client-side) (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### /client/v1/redemptions -#### Redeem Stackable Discounts (client-side) (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/client_redemptions_redeem_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/client_redemptions_redeem_response_body.rb) ✅ -### /client/v1/validations -#### Validate Stackable Discounts (client-side) (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/client_validations_validate_response_body.rb) ✅ -- **ResponseSupported:** ❌ -### /client/v1/customers/{customerId}/consents -#### Update Customer's consents (client-side) (put) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/.rb) ✅ -- **ResponseSupported:** *Not applicable* -### /client/v1/events -#### Track Custom Event (client-side) (post) -- **RequestSupported:** [link](./lib/VoucherifySDK/models/client_events_create_response_body.rb) ✅ -- **ResponseSupported:** [link](./lib/VoucherifySDK/models/client_events_create_response_body.rb) ✅ -### /client/v1/consents -#### List Consents (client-side) (get) -- **RequestSupported:** *Not applicable* -- **ResponseSupported:** ❌ -### ~~❗/client/v1/validate [Deprecated]❗~~ -#### ~~❗Validate Voucher (client-side) [Deprecated] (get)❗~~ -### ~~❗/client/v1/redeem [Deprecated]❗~~ -#### ~~❗Redeem Voucher (client-side) [Deprecated] (post)❗~~ +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------ | ------ | ----------------------------------------------------- | ------------------------------------ | ------------------------------------ | +| /client/v1/qualifications | post | Check Eligibility (client-side) | supported | | +| /client/v1/promotions/tiers | get | List Promotion Tiers (client-side) | supported | | +| /client/v1/redemptions | post | Redeem Stackable Discounts (client-side) | supported | | +| /client/v1/validations | post | Validate Stackable Discounts (client-side) | supported | | +| /client/v1/customers/{customerId}/consents | put | Update Customer's consents (client-side) [Deprecated] | | deprecated | +| /client/v1/events | post | Track Custom Event (client-side) | supported | | +| /client/v1/consents | get | List Consents (client-side) [Deprecated] | | deprecated | +| /client/v1/validate | get | Validate Voucher (client-side) [Deprecated] | | deprecated | +| /client/v1/redeem | post | Redeem Voucher (client-side) [Deprecated] | | deprecated | +| /client/v1/publish | post | Create Publication (client-side) | | | \ No newline at end of file diff --git a/EXAMPLES.md b/EXAMPLES.md index 662f9baf..a01d922d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -67,15 +67,15 @@ gem build VoucherifySdk.gemspec Then either install the gem locally: ```shell -gem install ./VoucherifySdk-5.0.1.gem +gem install ./VoucherifySdk-6.0.0.gem ``` -(for development, run `gem install --dev ./VoucherifySdk-5.0.1.gem` to install the development dependencies) +(for development, run `gem install --dev ./VoucherifySdk-6.0.0.gem` to install the development dependencies) Add this to the Gemfile: ```shell -gem 'VoucherifySdk', '~> 5.0.1' +gem 'VoucherifySdk', '~> 6.0.0' ``` Then install dependencies with bundler diff --git a/README.md b/README.md index 90227d80..d0384d32 100644 --- a/README.md +++ b/README.md @@ -113,13 +113,11 @@ Remember that this SDK is auto generated (except of the tests) so changes made h ## 📅 Changelog -- **2024-05-08** - `5.0.1` - Added support for [Create validation rule assignment](https://docs.voucherify.io/reference/create-validation-rule-assignment) +- **2024-09-05** - `6.0.0` - The new version of the SKD includes coverage for all the most commonly used Voucherify endpoints and supports typed models. -- **2024-03-11** - `5.0.0` - The new version of the SKD includes coverage for all the most commonly used Voucherify endpoints and supports typed models. +*Previous versions of the SDK are no longer supported, and we highly recommend upgrading to version 6.0.0, which is now designated as Long-Term Support (LTS).* -*Previous versions of the API are no longer supported, and we highly recommend upgrading to version 5.0.0, which is now designated as Long-Term Support (LTS).* - -*Changelog for previous versions could be found in the [CHANGELOG.md file](./CHANGELOG.md)* +*Changelog for previous versions could be found in the [DEPRECATED_CHANGELOG.md file](./DEPRECATED_CHANGELOG.md)* ## 🔐 Documentation for Authorization @@ -146,6 +144,8 @@ All URIs are relative to *https://api.voucherify.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*VoucherifySdk::AsyncActionsApi* | [**get_async_action**](docs/AsyncActionsApi.md#get_async_action) | **GET** /v1/async-actions/{asyncActionId} | Get Async Action +*VoucherifySdk::AsyncActionsApi* | [**list_async_actions**](docs/AsyncActionsApi.md#list_async_actions) | **GET** /v1/async-actions | List Async Actions *VoucherifySdk::CampaignsApi* | [**add_voucher_with_specific_code_to_campaign**](docs/CampaignsApi.md#add_voucher_with_specific_code_to_campaign) | **POST** /v1/campaigns/{campaignId}/vouchers/{code} | Add Voucher with Specific Code to Campaign *VoucherifySdk::CampaignsApi* | [**add_vouchers_to_campaign**](docs/CampaignsApi.md#add_vouchers_to_campaign) | **POST** /v1/campaigns/{campaignId}/vouchers | Add Vouchers to Campaign *VoucherifySdk::CampaignsApi* | [**create_campaign**](docs/CampaignsApi.md#create_campaign) | **POST** /v1/campaigns | Create Campaign @@ -163,29 +163,36 @@ Class | Method | HTTP request | Description *VoucherifySdk::CategoriesApi* | [**list_categories**](docs/CategoriesApi.md#list_categories) | **GET** /v1/categories | List Categories *VoucherifySdk::CategoriesApi* | [**update_category**](docs/CategoriesApi.md#update_category) | **PUT** /v1/categories/{categoryId} | Update Category *VoucherifySdk::ClientSideApi* | [**check_eligibility_client_side**](docs/ClientSideApi.md#check_eligibility_client_side) | **POST** /client/v1/qualifications | Check Eligibility (client-side) +*VoucherifySdk::ClientSideApi* | [**list_promotion_tiers_client_side**](docs/ClientSideApi.md#list_promotion_tiers_client_side) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (client-side) *VoucherifySdk::ClientSideApi* | [**redeem_stacked_discounts_client_side**](docs/ClientSideApi.md#redeem_stacked_discounts_client_side) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) *VoucherifySdk::ClientSideApi* | [**track_custom_event_client_side**](docs/ClientSideApi.md#track_custom_event_client_side) | **POST** /client/v1/events | Track Custom Event (client-side) -*VoucherifySdk::ClientSideApi* | [**update_customers_consents_client_side**](docs/ClientSideApi.md#update_customers_consents_client_side) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) *VoucherifySdk::ClientSideApi* | [**validate_stacked_discounts_client_side**](docs/ClientSideApi.md#validate_stacked_discounts_client_side) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) *VoucherifySdk::CustomersApi* | [**create_customer**](docs/CustomersApi.md#create_customer) | **POST** /v1/customers | Create Customer *VoucherifySdk::CustomersApi* | [**customer_permanently_deletion**](docs/CustomersApi.md#customer_permanently_deletion) | **POST** /v1/customers/{customerId}/permanent-deletion | Delete Customer Permanently *VoucherifySdk::CustomersApi* | [**delete_customer**](docs/CustomersApi.md#delete_customer) | **DELETE** /v1/customers/{customerId} | Delete Customer *VoucherifySdk::CustomersApi* | [**get_customer**](docs/CustomersApi.md#get_customer) | **GET** /v1/customers/{customerId} | Get Customer *VoucherifySdk::CustomersApi* | [**import_customers_using_csv**](docs/CustomersApi.md#import_customers_using_csv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV -*VoucherifySdk::CustomersApi* | [**list_customer_activities**](docs/CustomersApi.md#list_customer_activities) | **GET** /v1/customers/{customerId}/activities | List Customer Activities +*VoucherifySdk::CustomersApi* | [**list_customer_activities**](docs/CustomersApi.md#list_customer_activities) | **GET** /v1/customers/{customerId}/activities | List Customer Activities [Deprecated] +*VoucherifySdk::CustomersApi* | [**list_customer_activity**](docs/CustomersApi.md#list_customer_activity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity +*VoucherifySdk::CustomersApi* | [**list_customer_redeemables**](docs/CustomersApi.md#list_customer_redeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables *VoucherifySdk::CustomersApi* | [**list_customer_segments**](docs/CustomersApi.md#list_customer_segments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments *VoucherifySdk::CustomersApi* | [**list_customers**](docs/CustomersApi.md#list_customers) | **GET** /v1/customers | List Customers *VoucherifySdk::CustomersApi* | [**update_customer**](docs/CustomersApi.md#update_customer) | **PUT** /v1/customers/{customerId} | Update Customer -*VoucherifySdk::CustomersApi* | [**update_customers_consents**](docs/CustomersApi.md#update_customers_consents) | **PUT** /v1/customers/{customerId}/consents | Update Customer's consents -*VoucherifySdk::CustomersApi* | [**update_customers_in_bulk**](docs/CustomersApi.md#update_customers_in_bulk) | **POST** /v1/customers/bulk/async | Update Customers in bulk -*VoucherifySdk::CustomersApi* | [**update_customers_metadata_in_bulk**](docs/CustomersApi.md#update_customers_metadata_in_bulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in bulk +*VoucherifySdk::CustomersApi* | [**update_customers_consents**](docs/CustomersApi.md#update_customers_consents) | **PUT** /v1/customers/{customerId}/consents | Update Customer's consents [Deprecated] +*VoucherifySdk::CustomersApi* | [**update_customers_in_bulk**](docs/CustomersApi.md#update_customers_in_bulk) | **POST** /v1/customers/bulk/async | Update Customers in Bulk +*VoucherifySdk::CustomersApi* | [**update_customers_metadata_in_bulk**](docs/CustomersApi.md#update_customers_metadata_in_bulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in Bulk *VoucherifySdk::EventsApi* | [**track_custom_event**](docs/EventsApi.md#track_custom_event) | **POST** /v1/events | Track Custom Event *VoucherifySdk::ExportsApi* | [**create_export**](docs/ExportsApi.md#create_export) | **POST** /v1/exports | Create Export *VoucherifySdk::ExportsApi* | [**delete_export**](docs/ExportsApi.md#delete_export) | **DELETE** /v1/exports/{exportId} | Delete Export *VoucherifySdk::ExportsApi* | [**download_export**](docs/ExportsApi.md#download_export) | **GET** /v1/exports/{export_Id} | Download Export *VoucherifySdk::ExportsApi* | [**get_export**](docs/ExportsApi.md#get_export) | **GET** /v1/exports/{exportId} | Get Export *VoucherifySdk::ExportsApi* | [**list_exports**](docs/ExportsApi.md#list_exports) | **GET** /v1/exports | List Exports +*VoucherifySdk::LoyaltiesApi* | [**add_member**](docs/LoyaltiesApi.md#add_member) | **POST** /v1/loyalties/{campaignId}/members | Add Member +*VoucherifySdk::LoyaltiesApi* | [**create_earning_rule**](docs/LoyaltiesApi.md#create_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules | Create Earning Rule *VoucherifySdk::LoyaltiesApi* | [**create_in_bulk_loyalty_tiers**](docs/LoyaltiesApi.md#create_in_bulk_loyalty_tiers) | **POST** /v1/loyalties/{campaignId}/tiers | Create loyalty tiers +*VoucherifySdk::LoyaltiesApi* | [**create_loyalty_program**](docs/LoyaltiesApi.md#create_loyalty_program) | **POST** /v1/loyalties | Create Loyalty Campaign +*VoucherifySdk::LoyaltiesApi* | [**create_points_expiration_export**](docs/LoyaltiesApi.md#create_points_expiration_export) | **POST** /v1/loyalties/{campaignId}/points-expiration/export | Create Points Expiration Export +*VoucherifySdk::LoyaltiesApi* | [**create_reward_assignment1**](docs/LoyaltiesApi.md#create_reward_assignment1) | **POST** /v1/loyalties/{campaignId}/rewards | Create Reward Assignment *VoucherifySdk::LoyaltiesApi* | [**delete_earning_rule**](docs/LoyaltiesApi.md#delete_earning_rule) | **DELETE** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Delete Earning Rule *VoucherifySdk::LoyaltiesApi* | [**delete_loyalty_program**](docs/LoyaltiesApi.md#delete_loyalty_program) | **DELETE** /v1/loyalties/{campaignId} | Delete Loyalty Campaign *VoucherifySdk::LoyaltiesApi* | [**delete_reward_assignment1**](docs/LoyaltiesApi.md#delete_reward_assignment1) | **DELETE** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Delete Reward Assignment @@ -194,23 +201,36 @@ Class | Method | HTTP request | Description *VoucherifySdk::LoyaltiesApi* | [**export_loyalty_card_transactions**](docs/LoyaltiesApi.md#export_loyalty_card_transactions) | **POST** /v1/loyalties/members/{memberId}/transactions/export | Export Loyalty Card Transactions *VoucherifySdk::LoyaltiesApi* | [**export_loyalty_card_transactions1**](docs/LoyaltiesApi.md#export_loyalty_card_transactions1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | Export Loyalty Card Transactions *VoucherifySdk::LoyaltiesApi* | [**get_earning_rule**](docs/LoyaltiesApi.md#get_earning_rule) | **GET** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Get Earning Rule +*VoucherifySdk::LoyaltiesApi* | [**get_loyalty_program**](docs/LoyaltiesApi.md#get_loyalty_program) | **GET** /v1/loyalties/{campaignId} | Get Loyalty Campaign *VoucherifySdk::LoyaltiesApi* | [**get_loyalty_tier**](docs/LoyaltiesApi.md#get_loyalty_tier) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | Get Loyalty Tier +*VoucherifySdk::LoyaltiesApi* | [**get_member**](docs/LoyaltiesApi.md#get_member) | **GET** /v1/loyalties/members/{memberId} | Get Member +*VoucherifySdk::LoyaltiesApi* | [**get_member1**](docs/LoyaltiesApi.md#get_member1) | **GET** /v1/loyalties/{campaignId}/members/{memberId} | Get Member *VoucherifySdk::LoyaltiesApi* | [**get_reward_assignment1**](docs/LoyaltiesApi.md#get_reward_assignment1) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | Get Reward Assignment *VoucherifySdk::LoyaltiesApi* | [**get_reward_assignment2**](docs/LoyaltiesApi.md#get_reward_assignment2) | **GET** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Get Reward Assignment *VoucherifySdk::LoyaltiesApi* | [**get_reward_details**](docs/LoyaltiesApi.md#get_reward_details) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | Get Reward Details +*VoucherifySdk::LoyaltiesApi* | [**list_earning_rules**](docs/LoyaltiesApi.md#list_earning_rules) | **GET** /v1/loyalties/{campaignId}/earning-rules | List Earning Rules *VoucherifySdk::LoyaltiesApi* | [**list_loyalty_card_transactions**](docs/LoyaltiesApi.md#list_loyalty_card_transactions) | **GET** /v1/loyalties/members/{memberId}/transactions | List Loyalty Card Transactions *VoucherifySdk::LoyaltiesApi* | [**list_loyalty_card_transactions1**](docs/LoyaltiesApi.md#list_loyalty_card_transactions1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/transactions | List Loyalty Card Transactions +*VoucherifySdk::LoyaltiesApi* | [**list_loyalty_programs**](docs/LoyaltiesApi.md#list_loyalty_programs) | **GET** /v1/loyalties | List Loyalty Campaigns *VoucherifySdk::LoyaltiesApi* | [**list_loyalty_tier_earning_rules**](docs/LoyaltiesApi.md#list_loyalty_tier_earning_rules) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | List Loyalty Tier Earning Rules *VoucherifySdk::LoyaltiesApi* | [**list_loyalty_tier_rewards**](docs/LoyaltiesApi.md#list_loyalty_tier_rewards) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | List Loyalty Tier Rewards *VoucherifySdk::LoyaltiesApi* | [**list_loyalty_tiers**](docs/LoyaltiesApi.md#list_loyalty_tiers) | **GET** /v1/loyalties/{campaignId}/tiers | List Loyalty Tiers +*VoucherifySdk::LoyaltiesApi* | [**list_member_activity**](docs/LoyaltiesApi.md#list_member_activity) | **GET** /v1/loyalties/members/{memberId}/activity | List Member Activity +*VoucherifySdk::LoyaltiesApi* | [**list_member_activity1**](docs/LoyaltiesApi.md#list_member_activity1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/activity | List Member Activity *VoucherifySdk::LoyaltiesApi* | [**list_member_loyalty_tier**](docs/LoyaltiesApi.md#list_member_loyalty_tier) | **GET** /v1/loyalties/members/{memberId}/tiers | List Member's Loyalty Tiers *VoucherifySdk::LoyaltiesApi* | [**list_member_rewards**](docs/LoyaltiesApi.md#list_member_rewards) | **GET** /v1/loyalties/members/{memberId}/rewards | List Member Rewards +*VoucherifySdk::LoyaltiesApi* | [**list_members**](docs/LoyaltiesApi.md#list_members) | **GET** /v1/loyalties/{campaignId}/members | List Members *VoucherifySdk::LoyaltiesApi* | [**list_points_expiration**](docs/LoyaltiesApi.md#list_points_expiration) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | Get Points Expiration +*VoucherifySdk::LoyaltiesApi* | [**list_reward_assignments1**](docs/LoyaltiesApi.md#list_reward_assignments1) | **GET** /v1/loyalties/{campaignId}/reward-assignments | List Reward Assignments +*VoucherifySdk::LoyaltiesApi* | [**list_reward_assignments2**](docs/LoyaltiesApi.md#list_reward_assignments2) | **GET** /v1/loyalties/{campaignId}/rewards | List Reward Assignments *VoucherifySdk::LoyaltiesApi* | [**redeem_reward**](docs/LoyaltiesApi.md#redeem_reward) | **POST** /v1/loyalties/members/{memberId}/redemption | Redeem Reward *VoucherifySdk::LoyaltiesApi* | [**redeem_reward1**](docs/LoyaltiesApi.md#redeem_reward1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/redemption | Redeem Reward *VoucherifySdk::LoyaltiesApi* | [**transfer_points**](docs/LoyaltiesApi.md#transfer_points) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transfers | Transfer Loyalty Points +*VoucherifySdk::LoyaltiesApi* | [**update_earning_rule**](docs/LoyaltiesApi.md#update_earning_rule) | **PUT** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Update Earning Rule *VoucherifySdk::LoyaltiesApi* | [**update_loyalty_card_balance**](docs/LoyaltiesApi.md#update_loyalty_card_balance) | **POST** /v1/loyalties/members/{memberId}/balance | Add or Remove Loyalty Card Balance *VoucherifySdk::LoyaltiesApi* | [**update_loyalty_card_balance1**](docs/LoyaltiesApi.md#update_loyalty_card_balance1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/balance | Add or Remove Loyalty Card Balance +*VoucherifySdk::LoyaltiesApi* | [**update_loyalty_program**](docs/LoyaltiesApi.md#update_loyalty_program) | **PUT** /v1/loyalties/{campaignId} | Update Loyalty Campaign +*VoucherifySdk::LoyaltiesApi* | [**update_reward_assignment1**](docs/LoyaltiesApi.md#update_reward_assignment1) | **PUT** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Update Reward Assignment *VoucherifySdk::OrdersApi* | [**create_order**](docs/OrdersApi.md#create_order) | **POST** /v1/orders | Create Order *VoucherifySdk::OrdersApi* | [**create_order_export**](docs/OrdersApi.md#create_order_export) | **POST** /v1/orders/export | Create Orders Export *VoucherifySdk::OrdersApi* | [**get_order**](docs/OrdersApi.md#get_order) | **GET** /v1/orders/{orderId} | Get Order @@ -233,9 +253,10 @@ Class | Method | HTTP request | Description *VoucherifySdk::ProductsApi* | [**list_products**](docs/ProductsApi.md#list_products) | **GET** /v1/products | List Products *VoucherifySdk::ProductsApi* | [**list_skus_in_product**](docs/ProductsApi.md#list_skus_in_product) | **GET** /v1/products/{productId}/skus | List SKUs in Product *VoucherifySdk::ProductsApi* | [**update_product**](docs/ProductsApi.md#update_product) | **PUT** /v1/products/{productId} | Update Product -*VoucherifySdk::ProductsApi* | [**update_products_in_bulk**](docs/ProductsApi.md#update_products_in_bulk) | **POST** /v1/products/bulk/async | Update Products in bulk -*VoucherifySdk::ProductsApi* | [**update_products_metadata_in_bulk**](docs/ProductsApi.md#update_products_metadata_in_bulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in bulk +*VoucherifySdk::ProductsApi* | [**update_products_in_bulk**](docs/ProductsApi.md#update_products_in_bulk) | **POST** /v1/products/bulk/async | Update Products in Bulk +*VoucherifySdk::ProductsApi* | [**update_products_metadata_in_bulk**](docs/ProductsApi.md#update_products_metadata_in_bulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in Bulk *VoucherifySdk::ProductsApi* | [**update_sku**](docs/ProductsApi.md#update_sku) | **PUT** /v1/products/{productId}/skus/{skuId} | Update SKU +*VoucherifySdk::PromotionsApi* | [**add_promotion_tier_to_campaign**](docs/PromotionsApi.md#add_promotion_tier_to_campaign) | **POST** /v1/promotions/{campaignId}/tiers | Add Promotion Tier to Campaign *VoucherifySdk::PromotionsApi* | [**create_promotion_stack**](docs/PromotionsApi.md#create_promotion_stack) | **POST** /v1/promotions/{campaignId}/stacks | Create Promotion Stack *VoucherifySdk::PromotionsApi* | [**delete_promotion_stack**](docs/PromotionsApi.md#delete_promotion_stack) | **DELETE** /v1/promotions/{campaignId}/stacks/{stackId} | Delete Promotion Stack *VoucherifySdk::PromotionsApi* | [**delete_promotion_tier**](docs/PromotionsApi.md#delete_promotion_tier) | **DELETE** /v1/promotions/tiers/{promotionTierId} | Delete Promotion Tier @@ -245,8 +266,10 @@ Class | Method | HTTP request | Description *VoucherifySdk::PromotionsApi* | [**get_promotion_tier**](docs/PromotionsApi.md#get_promotion_tier) | **GET** /v1/promotions/tiers/{promotionTierId} | Get Promotion Tier *VoucherifySdk::PromotionsApi* | [**list_all_promotion_stacks**](docs/PromotionsApi.md#list_all_promotion_stacks) | **GET** /v1/promotions/stacks | List Promotion Stacks *VoucherifySdk::PromotionsApi* | [**list_promotion_stacks_in_campaign**](docs/PromotionsApi.md#list_promotion_stacks_in_campaign) | **GET** /v1/promotions/{campaignId}/stacks | List Promotion Stacks in Campaign +*VoucherifySdk::PromotionsApi* | [**list_promotion_tiers**](docs/PromotionsApi.md#list_promotion_tiers) | **GET** /v1/promotions/tiers | List Promotion Tiers *VoucherifySdk::PromotionsApi* | [**list_promotion_tiers_from_campaign**](docs/PromotionsApi.md#list_promotion_tiers_from_campaign) | **GET** /v1/promotions/{campaignId}/tiers | List Promotion Tiers from Campaign *VoucherifySdk::PromotionsApi* | [**update_promotion_stack**](docs/PromotionsApi.md#update_promotion_stack) | **PUT** /v1/promotions/{campaignId}/stacks/{stackId} | Update Promotion Stack +*VoucherifySdk::PromotionsApi* | [**update_promotion_tier**](docs/PromotionsApi.md#update_promotion_tier) | **PUT** /v1/promotions/tiers/{promotionTierId} | Update Promotion Tier *VoucherifySdk::PublicationsApi* | [**create_publication**](docs/PublicationsApi.md#create_publication) | **POST** /v1/publications | Create Publication *VoucherifySdk::PublicationsApi* | [**create_publication1**](docs/PublicationsApi.md#create_publication1) | **GET** /v1/publications/create | Create Publication *VoucherifySdk::PublicationsApi* | [**list_publications**](docs/PublicationsApi.md#list_publications) | **GET** /v1/publications | List Publications @@ -257,13 +280,19 @@ Class | Method | HTTP request | Description *VoucherifySdk::RedemptionsApi* | [**redeem_stacked_discounts**](docs/RedemptionsApi.md#redeem_stacked_discounts) | **POST** /v1/redemptions | Redeem Stackable Discounts *VoucherifySdk::RedemptionsApi* | [**rollback_redemption**](docs/RedemptionsApi.md#rollback_redemption) | **POST** /v1/redemptions/{redemptionId}/rollback | Rollback Redemption *VoucherifySdk::RedemptionsApi* | [**rollback_stacked_redemptions**](docs/RedemptionsApi.md#rollback_stacked_redemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions +*VoucherifySdk::RewardsApi* | [**create_reward**](docs/RewardsApi.md#create_reward) | **POST** /v1/rewards | Create Reward *VoucherifySdk::RewardsApi* | [**create_reward_assignment**](docs/RewardsApi.md#create_reward_assignment) | **POST** /v1/rewards/{rewardId}/assignments | Create Reward Assignment *VoucherifySdk::RewardsApi* | [**delete_reward**](docs/RewardsApi.md#delete_reward) | **DELETE** /v1/rewards/{rewardId} | Delete Reward *VoucherifySdk::RewardsApi* | [**delete_reward_assignment**](docs/RewardsApi.md#delete_reward_assignment) | **DELETE** /v1/rewards/{rewardId}/assignments/{assignmentId} | Delete Reward Assignment +*VoucherifySdk::RewardsApi* | [**get_reward**](docs/RewardsApi.md#get_reward) | **GET** /v1/rewards/{rewardId} | Get Reward *VoucherifySdk::RewardsApi* | [**get_reward_assignment**](docs/RewardsApi.md#get_reward_assignment) | **GET** /v1/rewards/{rewardId}/assignments/{assignmentId} | Get Reward Assignment *VoucherifySdk::RewardsApi* | [**list_reward_assignments**](docs/RewardsApi.md#list_reward_assignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments +*VoucherifySdk::RewardsApi* | [**list_rewards**](docs/RewardsApi.md#list_rewards) | **GET** /v1/rewards | List Rewards +*VoucherifySdk::RewardsApi* | [**update_reward**](docs/RewardsApi.md#update_reward) | **PUT** /v1/rewards/{rewardId} | Update Reward *VoucherifySdk::RewardsApi* | [**update_reward_assignment**](docs/RewardsApi.md#update_reward_assignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment +*VoucherifySdk::SegmentsApi* | [**create_segment**](docs/SegmentsApi.md#create_segment) | **POST** /v1/segments | Create Segment *VoucherifySdk::SegmentsApi* | [**delete_segment**](docs/SegmentsApi.md#delete_segment) | **DELETE** /v1/segments/{segmentId} | Delete Segment +*VoucherifySdk::SegmentsApi* | [**get_segment**](docs/SegmentsApi.md#get_segment) | **GET** /v1/segments/{segmentId} | Get Segment *VoucherifySdk::ValidationRulesApi* | [**create_validation_rule_assignment**](docs/ValidationRulesApi.md#create_validation_rule_assignment) | **POST** /v1/validation-rules/{validationRuleId}/assignments | Create Validation Rules Assignments *VoucherifySdk::ValidationRulesApi* | [**create_validation_rules**](docs/ValidationRulesApi.md#create_validation_rules) | **POST** /v1/validation-rules | Create Validation Rules *VoucherifySdk::ValidationRulesApi* | [**delete_validation_rule_assignment**](docs/ValidationRulesApi.md#delete_validation_rule_assignment) | **DELETE** /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | Delete Validation Rule Assignment @@ -274,69 +303,71 @@ Class | Method | HTTP request | Description *VoucherifySdk::ValidationRulesApi* | [**list_validation_rules_assignments**](docs/ValidationRulesApi.md#list_validation_rules_assignments) | **GET** /v1/validation-rules-assignments | List Validation Rules' Assignment(s) *VoucherifySdk::ValidationRulesApi* | [**update_validation_rule**](docs/ValidationRulesApi.md#update_validation_rule) | **PUT** /v1/validation-rules/{validationRuleId} | Update Validation Rule *VoucherifySdk::ValidationsApi* | [**validate_stacked_discounts**](docs/ValidationsApi.md#validate_stacked_discounts) | **POST** /v1/validations | Validate Stackable Discounts +*VoucherifySdk::VouchersApi* | [**create_voucher**](docs/VouchersApi.md#create_voucher) | **POST** /v1/vouchers/{code} | Create Voucher *VoucherifySdk::VouchersApi* | [**delete_voucher**](docs/VouchersApi.md#delete_voucher) | **DELETE** /v1/vouchers/{code} | Delete Voucher *VoucherifySdk::VouchersApi* | [**disable_voucher**](docs/VouchersApi.md#disable_voucher) | **POST** /v1/vouchers/{code}/disable | Disable Voucher *VoucherifySdk::VouchersApi* | [**enable_voucher**](docs/VouchersApi.md#enable_voucher) | **POST** /v1/vouchers/{code}/enable | Enable Voucher *VoucherifySdk::VouchersApi* | [**export_voucher_transactions**](docs/VouchersApi.md#export_voucher_transactions) | **POST** /v1/vouchers/{code}/transactions/export | Export Voucher Transactions +*VoucherifySdk::VouchersApi* | [**generate_random_code**](docs/VouchersApi.md#generate_random_code) | **POST** /v1/vouchers | Generate Random Code *VoucherifySdk::VouchersApi* | [**get_voucher**](docs/VouchersApi.md#get_voucher) | **GET** /v1/vouchers/{code} | Get Voucher +*VoucherifySdk::VouchersApi* | [**import_vouchers**](docs/VouchersApi.md#import_vouchers) | **POST** /v1/vouchers/import | Import Vouchers *VoucherifySdk::VouchersApi* | [**import_vouchers_using_csv**](docs/VouchersApi.md#import_vouchers_using_csv) | **POST** /v1/vouchers/importCSV | Import Vouchers using CSV *VoucherifySdk::VouchersApi* | [**list_voucher_transactions**](docs/VouchersApi.md#list_voucher_transactions) | **GET** /v1/vouchers/{code}/transactions | List Voucher Transactions +*VoucherifySdk::VouchersApi* | [**list_vouchers**](docs/VouchersApi.md#list_vouchers) | **GET** /v1/vouchers | List Vouchers *VoucherifySdk::VouchersApi* | [**release_validation_session**](docs/VouchersApi.md#release_validation_session) | **DELETE** /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session +*VoucherifySdk::VouchersApi* | [**update_voucher**](docs/VouchersApi.md#update_voucher) | **PUT** /v1/vouchers/{code} | Update Voucher *VoucherifySdk::VouchersApi* | [**update_voucher_balance**](docs/VouchersApi.md#update_voucher_balance) | **POST** /v1/vouchers/{code}/balance | Add or Remove Voucher Balance +*VoucherifySdk::VouchersApi* | [**update_vouchers_in_bulk**](docs/VouchersApi.md#update_vouchers_in_bulk) | **POST** /v1/vouchers/bulk/async | Update Vouchers in Bulk +*VoucherifySdk::VouchersApi* | [**update_vouchers_metadata_in_bulk**](docs/VouchersApi.md#update_vouchers_metadata_in_bulk) | **POST** /v1/vouchers/metadata/async | Update Vouchers' Metadata in Bulk ## 📚 Documentation for Models - - [VoucherifySdk::Any](docs/Any.md) + - [VoucherifySdk::AccessSettingsCampaignAssignmentsList](docs/AccessSettingsCampaignAssignmentsList.md) - [VoucherifySdk::ApplicableTo](docs/ApplicableTo.md) - [VoucherifySdk::ApplicableToEffect](docs/ApplicableToEffect.md) - [VoucherifySdk::ApplicableToResultList](docs/ApplicableToResultList.md) - - [VoucherifySdk::ArrayInner](docs/ArrayInner.md) - - [VoucherifySdk::AsyncActions](docs/AsyncActions.md) + - [VoucherifySdk::AreaStoreCampaignAssignment](docs/AreaStoreCampaignAssignment.md) + - [VoucherifySdk::AsyncActionBase](docs/AsyncActionBase.md) + - [VoucherifySdk::AsyncActionGetResponseBody](docs/AsyncActionGetResponseBody.md) + - [VoucherifySdk::AsyncActionsListResponseBody](docs/AsyncActionsListResponseBody.md) - [VoucherifySdk::BusValRuleAssignment](docs/BusValRuleAssignment.md) - - [VoucherifySdk::Campaign](docs/Campaign.md) - [VoucherifySdk::CampaignBase](docs/CampaignBase.md) - - [VoucherifySdk::CampaignBaseValidityTimeframe](docs/CampaignBaseValidityTimeframe.md) - [VoucherifySdk::CampaignLoyaltyCard](docs/CampaignLoyaltyCard.md) - [VoucherifySdk::CampaignLoyaltyCardExpirationRules](docs/CampaignLoyaltyCardExpirationRules.md) - [VoucherifySdk::CampaignLoyaltyVoucher](docs/CampaignLoyaltyVoucher.md) - [VoucherifySdk::CampaignLoyaltyVoucherRedemption](docs/CampaignLoyaltyVoucherRedemption.md) - [VoucherifySdk::CampaignVoucher](docs/CampaignVoucher.md) - [VoucherifySdk::CampaignVoucherRedemption](docs/CampaignVoucherRedemption.md) - - [VoucherifySdk::CampaignsCreateBase](docs/CampaignsCreateBase.md) - - [VoucherifySdk::CampaignsCreateDiscountCouponsCampaign](docs/CampaignsCreateDiscountCouponsCampaign.md) - - [VoucherifySdk::CampaignsCreateGiftCampaign](docs/CampaignsCreateGiftCampaign.md) - - [VoucherifySdk::CampaignsCreateGiveawayCampaign](docs/CampaignsCreateGiveawayCampaign.md) - - [VoucherifySdk::CampaignsCreateLoyaltyCampaign](docs/CampaignsCreateLoyaltyCampaign.md) - - [VoucherifySdk::CampaignsCreatePromotionCampaign](docs/CampaignsCreatePromotionCampaign.md) - - [VoucherifySdk::CampaignsCreateReferralCampaign](docs/CampaignsCreateReferralCampaign.md) - [VoucherifySdk::CampaignsCreateRequestBody](docs/CampaignsCreateRequestBody.md) + - [VoucherifySdk::CampaignsCreateRequestBodyPromotion](docs/CampaignsCreateRequestBodyPromotion.md) + - [VoucherifySdk::CampaignsCreateRequestBodyVoucher](docs/CampaignsCreateRequestBodyVoucher.md) + - [VoucherifySdk::CampaignsCreateRequestBodyVoucherRedemption](docs/CampaignsCreateRequestBodyVoucherRedemption.md) - [VoucherifySdk::CampaignsCreateResponseBody](docs/CampaignsCreateResponseBody.md) - [VoucherifySdk::CampaignsDeleteResponseBody](docs/CampaignsDeleteResponseBody.md) - - [VoucherifySdk::CampaignsDisableResponseBody](docs/CampaignsDisableResponseBody.md) - - [VoucherifySdk::CampaignsEnableResponseBody](docs/CampaignsEnableResponseBody.md) - [VoucherifySdk::CampaignsGetResponseBody](docs/CampaignsGetResponseBody.md) - [VoucherifySdk::CampaignsImportCreateResponseBody](docs/CampaignsImportCreateResponseBody.md) - [VoucherifySdk::CampaignsImportCsvCreateResponseBody](docs/CampaignsImportCsvCreateResponseBody.md) - [VoucherifySdk::CampaignsImportVoucherItem](docs/CampaignsImportVoucherItem.md) - [VoucherifySdk::CampaignsImportVoucherItemRedemption](docs/CampaignsImportVoucherItemRedemption.md) - - [VoucherifySdk::CampaignsImportVoucherLoyaltyCard](docs/CampaignsImportVoucherLoyaltyCard.md) - [VoucherifySdk::CampaignsListResponseBody](docs/CampaignsListResponseBody.md) - - [VoucherifySdk::CampaignsUpdateBase](docs/CampaignsUpdateBase.md) - - [VoucherifySdk::CampaignsUpdateCouponCampaignBase](docs/CampaignsUpdateCouponCampaignBase.md) - - [VoucherifySdk::CampaignsUpdateDiscountCouponsCampaign](docs/CampaignsUpdateDiscountCouponsCampaign.md) - - [VoucherifySdk::CampaignsUpdateGiftCampaign](docs/CampaignsUpdateGiftCampaign.md) - - [VoucherifySdk::CampaignsUpdateGiveawayCampaign](docs/CampaignsUpdateGiveawayCampaign.md) - - [VoucherifySdk::CampaignsUpdateLoyaltyCampaign](docs/CampaignsUpdateLoyaltyCampaign.md) - - [VoucherifySdk::CampaignsUpdatePromotionCampaign](docs/CampaignsUpdatePromotionCampaign.md) - - [VoucherifySdk::CampaignsUpdateReferralCampaign](docs/CampaignsUpdateReferralCampaign.md) - [VoucherifySdk::CampaignsUpdateRequestBody](docs/CampaignsUpdateRequestBody.md) + - [VoucherifySdk::CampaignsUpdateRequestBodyOptions](docs/CampaignsUpdateRequestBodyOptions.md) - [VoucherifySdk::CampaignsUpdateResponseBody](docs/CampaignsUpdateResponseBody.md) - - [VoucherifySdk::CampaignsVouchersCreateBaseRequestBody](docs/CampaignsVouchersCreateBaseRequestBody.md) + - [VoucherifySdk::CampaignsVouchersCreateCombinedResponseBody](docs/CampaignsVouchersCreateCombinedResponseBody.md) + - [VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyGift](docs/CampaignsVouchersCreateCombinedResponseBodyGift.md) + - [VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard](docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md) + - [VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyPublish](docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md) + - [VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyRedemption](docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md) - [VoucherifySdk::CampaignsVouchersCreateInBulkRequestBody](docs/CampaignsVouchersCreateInBulkRequestBody.md) - - [VoucherifySdk::CampaignsVouchersCreateInBulkResponseBody](docs/CampaignsVouchersCreateInBulkResponseBody.md) + - [VoucherifySdk::CampaignsVouchersCreateInBulkRequestBodyRedemption](docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md) - [VoucherifySdk::CampaignsVouchersCreateRequestBody](docs/CampaignsVouchersCreateRequestBody.md) + - [VoucherifySdk::CampaignsVouchersCreateRequestBodyRedemption](docs/CampaignsVouchersCreateRequestBodyRedemption.md) - [VoucherifySdk::CampaignsVouchersCreateResponseBody](docs/CampaignsVouchersCreateResponseBody.md) + - [VoucherifySdk::CampaignsVouchersCreateResponseBodyGift](docs/CampaignsVouchersCreateResponseBodyGift.md) + - [VoucherifySdk::CampaignsVouchersCreateResponseBodyLoyaltyCard](docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md) + - [VoucherifySdk::CampaignsVouchersCreateResponseBodyPublish](docs/CampaignsVouchersCreateResponseBodyPublish.md) + - [VoucherifySdk::CampaignsVouchersCreateResponseBodyRedemption](docs/CampaignsVouchersCreateResponseBodyRedemption.md) - [VoucherifySdk::CategoriesCreateRequestBody](docs/CategoriesCreateRequestBody.md) - [VoucherifySdk::CategoriesCreateResponseBody](docs/CategoriesCreateResponseBody.md) - [VoucherifySdk::CategoriesGetResponseBody](docs/CategoriesGetResponseBody.md) @@ -348,265 +379,295 @@ Class | Method | HTTP request | Description - [VoucherifySdk::ClientEventsCreateRequestBodyLoyalty](docs/ClientEventsCreateRequestBodyLoyalty.md) - [VoucherifySdk::ClientEventsCreateRequestBodyReferral](docs/ClientEventsCreateRequestBodyReferral.md) - [VoucherifySdk::ClientEventsCreateResponseBody](docs/ClientEventsCreateResponseBody.md) + - [VoucherifySdk::ClientPromotionsTiersListResponseBody](docs/ClientPromotionsTiersListResponseBody.md) - [VoucherifySdk::ClientQualificationsCheckEligibilityRequestBody](docs/ClientQualificationsCheckEligibilityRequestBody.md) - [VoucherifySdk::ClientQualificationsCheckEligibilityResponseBody](docs/ClientQualificationsCheckEligibilityResponseBody.md) - [VoucherifySdk::ClientRedemptionsRedeemRequestBody](docs/ClientRedemptionsRedeemRequestBody.md) - - [VoucherifySdk::ClientRedemptionsRedeemRequestBodyAllOfOptions](docs/ClientRedemptionsRedeemRequestBodyAllOfOptions.md) + - [VoucherifySdk::ClientRedemptionsRedeemRequestBodyOptions](docs/ClientRedemptionsRedeemRequestBodyOptions.md) + - [VoucherifySdk::ClientRedemptionsRedeemRequestBodyRedeemablesItem](docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md) + - [VoucherifySdk::ClientRedemptionsRedeemRequestBodyRedeemablesItemGift](docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md) + - [VoucherifySdk::ClientRedemptionsRedeemRequestBodyRedeemablesItemReward](docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md) - [VoucherifySdk::ClientRedemptionsRedeemResponseBody](docs/ClientRedemptionsRedeemResponseBody.md) - [VoucherifySdk::ClientValidationsValidateRequestBody](docs/ClientValidationsValidateRequestBody.md) - - [VoucherifySdk::ClientValidationsValidateRequestBodyAllOfOptions](docs/ClientValidationsValidateRequestBodyAllOfOptions.md) + - [VoucherifySdk::ClientValidationsValidateRequestBodyOptions](docs/ClientValidationsValidateRequestBodyOptions.md) + - [VoucherifySdk::ClientValidationsValidateRequestBodyRedeemablesItem](docs/ClientValidationsValidateRequestBodyRedeemablesItem.md) + - [VoucherifySdk::ClientValidationsValidateRequestBodyRedeemablesItemGift](docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md) + - [VoucherifySdk::ClientValidationsValidateRequestBodyRedeemablesItemReward](docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md) - [VoucherifySdk::ClientValidationsValidateResponseBody](docs/ClientValidationsValidateResponseBody.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItem](docs/ClientValidationsValidateResponseBodyRedeemablesItem.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResult](docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultDetails](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultGift](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md) + - [VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) - [VoucherifySdk::CodeConfig](docs/CodeConfig.md) - - [VoucherifySdk::CodeConfigRequiredLengthCharsetPattern](docs/CodeConfigRequiredLengthCharsetPattern.md) - - [VoucherifySdk::CreatePublicationBase](docs/CreatePublicationBase.md) - [VoucherifySdk::CreatePublicationCampaign](docs/CreatePublicationCampaign.md) - - [VoucherifySdk::CreatePublicationWithCampaign](docs/CreatePublicationWithCampaign.md) - - [VoucherifySdk::CreatePublicationWithSpecificVoucher](docs/CreatePublicationWithSpecificVoucher.md) - - [VoucherifySdk::CustomEvent](docs/CustomEvent.md) - - [VoucherifySdk::CustomEventReferral](docs/CustomEventReferral.md) - [VoucherifySdk::Customer](docs/Customer.md) - [VoucherifySdk::CustomerActivity](docs/CustomerActivity.md) - - [VoucherifySdk::CustomerActivityData](docs/CustomerActivityData.md) - - [VoucherifySdk::CustomerBase](docs/CustomerBase.md) - - [VoucherifySdk::CustomerBaseAddress](docs/CustomerBaseAddress.md) + - [VoucherifySdk::CustomerAddress](docs/CustomerAddress.md) - [VoucherifySdk::CustomerId](docs/CustomerId.md) - [VoucherifySdk::CustomerLoyalty](docs/CustomerLoyalty.md) - - [VoucherifySdk::CustomerLoyaltyCampaignsValue](docs/CustomerLoyaltyCampaignsValue.md) + - [VoucherifySdk::CustomerLoyaltyCampaignsEntry](docs/CustomerLoyaltyCampaignsEntry.md) + - [VoucherifySdk::CustomerRedeemable](docs/CustomerRedeemable.md) + - [VoucherifySdk::CustomerRedeemableRedeemable](docs/CustomerRedeemableRedeemable.md) - [VoucherifySdk::CustomerReferrals](docs/CustomerReferrals.md) - [VoucherifySdk::CustomerReferralsCampaignsItem](docs/CustomerReferralsCampaignsItem.md) - - [VoucherifySdk::CustomerResponseDataAssets](docs/CustomerResponseDataAssets.md) - - [VoucherifySdk::CustomerSegmentsList](docs/CustomerSegmentsList.md) - [VoucherifySdk::CustomerSummary](docs/CustomerSummary.md) - [VoucherifySdk::CustomerSummaryOrders](docs/CustomerSummaryOrders.md) - [VoucherifySdk::CustomerSummaryRedemptions](docs/CustomerSummaryRedemptions.md) - [VoucherifySdk::CustomerSummaryRedemptionsGift](docs/CustomerSummaryRedemptionsGift.md) - [VoucherifySdk::CustomerSummaryRedemptionsLoyaltyCard](docs/CustomerSummaryRedemptionsLoyaltyCard.md) - [VoucherifySdk::CustomerWithSummaryLoyaltyReferrals](docs/CustomerWithSummaryLoyaltyReferrals.md) + - [VoucherifySdk::CustomerWithSummaryLoyaltyReferralsAddress](docs/CustomerWithSummaryLoyaltyReferralsAddress.md) + - [VoucherifySdk::CustomerWithSummaryLoyaltyReferralsAssets](docs/CustomerWithSummaryLoyaltyReferralsAssets.md) - [VoucherifySdk::CustomersActivitiesListResponseBody](docs/CustomersActivitiesListResponseBody.md) + - [VoucherifySdk::CustomersActivityListResponseBody](docs/CustomersActivityListResponseBody.md) - [VoucherifySdk::CustomersCreateRequestBody](docs/CustomersCreateRequestBody.md) + - [VoucherifySdk::CustomersCreateRequestBodyAddress](docs/CustomersCreateRequestBodyAddress.md) - [VoucherifySdk::CustomersCreateResponseBody](docs/CustomersCreateResponseBody.md) + - [VoucherifySdk::CustomersCreateResponseBodyAddress](docs/CustomersCreateResponseBodyAddress.md) + - [VoucherifySdk::CustomersCreateResponseBodyAssets](docs/CustomersCreateResponseBodyAssets.md) - [VoucherifySdk::CustomersGetResponseBody](docs/CustomersGetResponseBody.md) + - [VoucherifySdk::CustomersGetResponseBodyAddress](docs/CustomersGetResponseBodyAddress.md) + - [VoucherifySdk::CustomersGetResponseBodyAssets](docs/CustomersGetResponseBodyAssets.md) - [VoucherifySdk::CustomersImportCsvCreateResponseBody](docs/CustomersImportCsvCreateResponseBody.md) - [VoucherifySdk::CustomersListResponseBody](docs/CustomersListResponseBody.md) - [VoucherifySdk::CustomersMetadataUpdateInBulkRequestBody](docs/CustomersMetadataUpdateInBulkRequestBody.md) - [VoucherifySdk::CustomersMetadataUpdateInBulkResponseBody](docs/CustomersMetadataUpdateInBulkResponseBody.md) - [VoucherifySdk::CustomersPermanentDeletionCreateResponseBody](docs/CustomersPermanentDeletionCreateResponseBody.md) - [VoucherifySdk::CustomersPermanentDeletionCreateResponseBodyDataJson](docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md) + - [VoucherifySdk::CustomersRedeemablesListResponseBody](docs/CustomersRedeemablesListResponseBody.md) - [VoucherifySdk::CustomersSegmentsListResponseBody](docs/CustomersSegmentsListResponseBody.md) - [VoucherifySdk::CustomersUpdateInBulkRequestBody](docs/CustomersUpdateInBulkRequestBody.md) + - [VoucherifySdk::CustomersUpdateInBulkRequestBodyAddress](docs/CustomersUpdateInBulkRequestBodyAddress.md) - [VoucherifySdk::CustomersUpdateInBulkResponseBody](docs/CustomersUpdateInBulkResponseBody.md) - [VoucherifySdk::CustomersUpdateRequestBody](docs/CustomersUpdateRequestBody.md) + - [VoucherifySdk::CustomersUpdateRequestBodyAddress](docs/CustomersUpdateRequestBodyAddress.md) - [VoucherifySdk::CustomersUpdateResponseBody](docs/CustomersUpdateResponseBody.md) + - [VoucherifySdk::CustomersUpdateResponseBodyAddress](docs/CustomersUpdateResponseBodyAddress.md) + - [VoucherifySdk::CustomersUpdateResponseBodyAssets](docs/CustomersUpdateResponseBodyAssets.md) - [VoucherifySdk::Discount](docs/Discount.md) - - [VoucherifySdk::DiscountAmount](docs/DiscountAmount.md) - - [VoucherifySdk::DiscountAmountVouchersEffectTypes](docs/DiscountAmountVouchersEffectTypes.md) - - [VoucherifySdk::DiscountCouponsCampaignVoucher](docs/DiscountCouponsCampaignVoucher.md) - - [VoucherifySdk::DiscountFixed](docs/DiscountFixed.md) - - [VoucherifySdk::DiscountFixedVouchersEffectTypes](docs/DiscountFixedVouchersEffectTypes.md) - - [VoucherifySdk::DiscountPercent](docs/DiscountPercent.md) - - [VoucherifySdk::DiscountPercentVouchersEffectTypes](docs/DiscountPercentVouchersEffectTypes.md) - - [VoucherifySdk::DiscountUnit](docs/DiscountUnit.md) - - [VoucherifySdk::DiscountUnitMultiple](docs/DiscountUnitMultiple.md) - [VoucherifySdk::DiscountUnitMultipleOneUnit](docs/DiscountUnitMultipleOneUnit.md) - - [VoucherifySdk::DiscountUnitVouchersEffectTypes](docs/DiscountUnitVouchersEffectTypes.md) - [VoucherifySdk::EarningRule](docs/EarningRule.md) - - [VoucherifySdk::EarningRuleBase](docs/EarningRuleBase.md) - - [VoucherifySdk::EarningRuleBaseCustomEvent](docs/EarningRuleBaseCustomEvent.md) - - [VoucherifySdk::EarningRuleBaseLoyalty](docs/EarningRuleBaseLoyalty.md) - - [VoucherifySdk::EarningRuleBaseSegment](docs/EarningRuleBaseSegment.md) - - [VoucherifySdk::EarningRuleBaseSource](docs/EarningRuleBaseSource.md) - - [VoucherifySdk::EarningRuleBaseValidityTimeframe](docs/EarningRuleBaseValidityTimeframe.md) - - [VoucherifySdk::EarningRuleEvent](docs/EarningRuleEvent.md) - - [VoucherifySdk::EarningRuleFixed](docs/EarningRuleFixed.md) - - [VoucherifySdk::EarningRuleProportional](docs/EarningRuleProportional.md) - - [VoucherifySdk::EarningRuleProportionalCustomEvent](docs/EarningRuleProportionalCustomEvent.md) - - [VoucherifySdk::EarningRuleProportionalCustomEventCustomEvent](docs/EarningRuleProportionalCustomEventCustomEvent.md) - - [VoucherifySdk::EarningRuleProportionalCustomEventCustomEventMetadata](docs/EarningRuleProportionalCustomEventCustomEventMetadata.md) - - [VoucherifySdk::EarningRuleProportionalCustomerMetadata](docs/EarningRuleProportionalCustomerMetadata.md) - - [VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomer](docs/EarningRuleProportionalCustomerMetadataCustomer.md) - - [VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomerMetadata](docs/EarningRuleProportionalCustomerMetadataCustomerMetadata.md) - - [VoucherifySdk::EarningRuleProportionalOrder](docs/EarningRuleProportionalOrder.md) - - [VoucherifySdk::EarningRuleProportionalOrderAmount](docs/EarningRuleProportionalOrderAmount.md) - - [VoucherifySdk::EarningRuleProportionalOrderAmountOrder](docs/EarningRuleProportionalOrderAmountOrder.md) - - [VoucherifySdk::EarningRuleProportionalOrderAmountOrderAmount](docs/EarningRuleProportionalOrderAmountOrderAmount.md) - - [VoucherifySdk::EarningRuleProportionalOrderItems](docs/EarningRuleProportionalOrderItems.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsAmount](docs/EarningRuleProportionalOrderItemsAmount.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItems](docs/EarningRuleProportionalOrderItemsAmountOrderItems.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItemsAmount](docs/EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsQuantity](docs/EarningRuleProportionalOrderItemsQuantity.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsQuantityOrderItems](docs/EarningRuleProportionalOrderItemsQuantityOrderItems.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmount](docs/EarningRuleProportionalOrderItemsSubtotalAmount.md) - - [VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmountOrderItems](docs/EarningRuleProportionalOrderItemsSubtotalAmountOrderItems.md) - - [VoucherifySdk::EarningRuleProportionalOrderMetadata](docs/EarningRuleProportionalOrderMetadata.md) - - [VoucherifySdk::EarningRuleProportionalOrderMetadataOrder](docs/EarningRuleProportionalOrderMetadataOrder.md) - - [VoucherifySdk::EarningRuleProportionalOrderMetadataOrderMetadata](docs/EarningRuleProportionalOrderMetadataOrderMetadata.md) - - [VoucherifySdk::EarningRuleProportionalOrderTotalAmount](docs/EarningRuleProportionalOrderTotalAmount.md) - - [VoucherifySdk::EarningRuleProportionalOrderTotalAmountOrder](docs/EarningRuleProportionalOrderTotalAmountOrder.md) + - [VoucherifySdk::EarningRuleCustomEvent](docs/EarningRuleCustomEvent.md) + - [VoucherifySdk::EarningRuleLoyalty](docs/EarningRuleLoyalty.md) + - [VoucherifySdk::EarningRuleLoyaltyCustomEvent](docs/EarningRuleLoyaltyCustomEvent.md) + - [VoucherifySdk::EarningRuleLoyaltyCustomEventMetadata](docs/EarningRuleLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::EarningRuleLoyaltyCustomer](docs/EarningRuleLoyaltyCustomer.md) + - [VoucherifySdk::EarningRuleLoyaltyCustomerMetadata](docs/EarningRuleLoyaltyCustomerMetadata.md) + - [VoucherifySdk::EarningRuleLoyaltyOrder](docs/EarningRuleLoyaltyOrder.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderAmount](docs/EarningRuleLoyaltyOrderAmount.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderItems](docs/EarningRuleLoyaltyOrderItems.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderItemsAmount](docs/EarningRuleLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderItemsQuantity](docs/EarningRuleLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderItemsSubtotalAmount](docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderMetadata](docs/EarningRuleLoyaltyOrderMetadata.md) + - [VoucherifySdk::EarningRuleLoyaltyOrderTotalAmount](docs/EarningRuleLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::EarningRuleLoyaltyTier](docs/EarningRuleLoyaltyTier.md) + - [VoucherifySdk::EarningRuleSegment](docs/EarningRuleSegment.md) + - [VoucherifySdk::EarningRuleSource](docs/EarningRuleSource.md) - [VoucherifySdk::Error](docs/Error.md) - - [VoucherifySdk::EventCustomerActiveCampaignFailed](docs/EventCustomerActiveCampaignFailed.md) - - [VoucherifySdk::EventCustomerActiveCampaignRecovered](docs/EventCustomerActiveCampaignRecovered.md) - - [VoucherifySdk::EventCustomerActiveCampaignSent](docs/EventCustomerActiveCampaignSent.md) - - [VoucherifySdk::EventCustomerBatchFailed](docs/EventCustomerBatchFailed.md) - - [VoucherifySdk::EventCustomerBatchRecovered](docs/EventCustomerBatchRecovered.md) - - [VoucherifySdk::EventCustomerBatchSent](docs/EventCustomerBatchSent.md) - - [VoucherifySdk::EventCustomerBrazeFailed](docs/EventCustomerBrazeFailed.md) - - [VoucherifySdk::EventCustomerBrazeRecovered](docs/EventCustomerBrazeRecovered.md) - - [VoucherifySdk::EventCustomerBrazeSent](docs/EventCustomerBrazeSent.md) - - [VoucherifySdk::EventCustomerConfirmed](docs/EventCustomerConfirmed.md) - - [VoucherifySdk::EventCustomerConfirmedUnconfirmedCustomer](docs/EventCustomerConfirmedUnconfirmedCustomer.md) - - [VoucherifySdk::EventCustomerConsents](docs/EventCustomerConsents.md) - - [VoucherifySdk::EventCustomerConsentsGiven](docs/EventCustomerConsentsGiven.md) - - [VoucherifySdk::EventCustomerConsentsRevoked](docs/EventCustomerConsentsRevoked.md) - - [VoucherifySdk::EventCustomerCreated](docs/EventCustomerCreated.md) - - [VoucherifySdk::EventCustomerCustomEvent](docs/EventCustomerCustomEvent.md) - - [VoucherifySdk::EventCustomerDeleted](docs/EventCustomerDeleted.md) - - [VoucherifySdk::EventCustomerEmailFailed](docs/EventCustomerEmailFailed.md) - - [VoucherifySdk::EventCustomerEmailRecovered](docs/EventCustomerEmailRecovered.md) - - [VoucherifySdk::EventCustomerEmailSent](docs/EventCustomerEmailSent.md) - - [VoucherifySdk::EventCustomerFailed](docs/EventCustomerFailed.md) - - [VoucherifySdk::EventCustomerGiftVoucherBalanceAdded](docs/EventCustomerGiftVoucherBalanceAdded.md) - - [VoucherifySdk::EventCustomerIntercomFailed](docs/EventCustomerIntercomFailed.md) - - [VoucherifySdk::EventCustomerIntercomRecovered](docs/EventCustomerIntercomRecovered.md) - - [VoucherifySdk::EventCustomerIntercomSent](docs/EventCustomerIntercomSent.md) - - [VoucherifySdk::EventCustomerKlaviyoFailed](docs/EventCustomerKlaviyoFailed.md) - - [VoucherifySdk::EventCustomerKlaviyoRecovered](docs/EventCustomerKlaviyoRecovered.md) - - [VoucherifySdk::EventCustomerKlaviyoSent](docs/EventCustomerKlaviyoSent.md) - - [VoucherifySdk::EventCustomerLoyaltyCardPointsAdded](docs/EventCustomerLoyaltyCardPointsAdded.md) - - [VoucherifySdk::EventCustomerLoyaltyCardPointsTransferred](docs/EventCustomerLoyaltyCardPointsTransferred.md) - - [VoucherifySdk::EventCustomerLoyaltyTierBase](docs/EventCustomerLoyaltyTierBase.md) - - [VoucherifySdk::EventCustomerLoyaltyTierDowngraded](docs/EventCustomerLoyaltyTierDowngraded.md) - - [VoucherifySdk::EventCustomerLoyaltyTierExpirationChanged](docs/EventCustomerLoyaltyTierExpirationChanged.md) - - [VoucherifySdk::EventCustomerLoyaltyTierJoined](docs/EventCustomerLoyaltyTierJoined.md) - - [VoucherifySdk::EventCustomerLoyaltyTierLeft](docs/EventCustomerLoyaltyTierLeft.md) - - [VoucherifySdk::EventCustomerLoyaltyTierProlonged](docs/EventCustomerLoyaltyTierProlonged.md) - - [VoucherifySdk::EventCustomerLoyaltyTierUpgraded](docs/EventCustomerLoyaltyTierUpgraded.md) - - [VoucherifySdk::EventCustomerLoyaltyUpdated](docs/EventCustomerLoyaltyUpdated.md) - - [VoucherifySdk::EventCustomerMailchimpFailed](docs/EventCustomerMailchimpFailed.md) - - [VoucherifySdk::EventCustomerMailchimpRecovered](docs/EventCustomerMailchimpRecovered.md) - - [VoucherifySdk::EventCustomerMailchimpSent](docs/EventCustomerMailchimpSent.md) - - [VoucherifySdk::EventCustomerOrder](docs/EventCustomerOrder.md) - - [VoucherifySdk::EventCustomerOrderCanceled](docs/EventCustomerOrderCanceled.md) - - [VoucherifySdk::EventCustomerOrderCreated](docs/EventCustomerOrderCreated.md) - - [VoucherifySdk::EventCustomerOrderFulfilled](docs/EventCustomerOrderFulfilled.md) - - [VoucherifySdk::EventCustomerOrderPaid](docs/EventCustomerOrderPaid.md) - - [VoucherifySdk::EventCustomerOrderProcessing](docs/EventCustomerOrderProcessing.md) - - [VoucherifySdk::EventCustomerOrderUpdated](docs/EventCustomerOrderUpdated.md) - - [VoucherifySdk::EventCustomerPublicationFailed](docs/EventCustomerPublicationFailed.md) - - [VoucherifySdk::EventCustomerPublicationSucceeded](docs/EventCustomerPublicationSucceeded.md) - - [VoucherifySdk::EventCustomerRecovered](docs/EventCustomerRecovered.md) - - [VoucherifySdk::EventCustomerRedemption](docs/EventCustomerRedemption.md) - - [VoucherifySdk::EventCustomerRedemptionFailed](docs/EventCustomerRedemptionFailed.md) - - [VoucherifySdk::EventCustomerRedemptionRollbackFailed](docs/EventCustomerRedemptionRollbackFailed.md) - - [VoucherifySdk::EventCustomerRedemptionRollbackSucceeded](docs/EventCustomerRedemptionRollbackSucceeded.md) - - [VoucherifySdk::EventCustomerRedemptionSucceeded](docs/EventCustomerRedemptionSucceeded.md) - - [VoucherifySdk::EventCustomerReferred](docs/EventCustomerReferred.md) - - [VoucherifySdk::EventCustomerRewardRedemptions](docs/EventCustomerRewardRedemptions.md) - - [VoucherifySdk::EventCustomerRewardRedemptionsCompleted](docs/EventCustomerRewardRedemptionsCompleted.md) - - [VoucherifySdk::EventCustomerRewardRedemptionsCreated](docs/EventCustomerRewardRedemptionsCreated.md) - - [VoucherifySdk::EventCustomerRewardRedemptionsPending](docs/EventCustomerRewardRedemptionsPending.md) - - [VoucherifySdk::EventCustomerRewardRedemptionsRolledBack](docs/EventCustomerRewardRedemptionsRolledBack.md) - - [VoucherifySdk::EventCustomerRewarded](docs/EventCustomerRewarded.md) - - [VoucherifySdk::EventCustomerRewardedLoyaltyPoints](docs/EventCustomerRewardedLoyaltyPoints.md) - - [VoucherifySdk::EventCustomerSegmentEntered](docs/EventCustomerSegmentEntered.md) - - [VoucherifySdk::EventCustomerSegmentLeft](docs/EventCustomerSegmentLeft.md) - - [VoucherifySdk::EventCustomerSent](docs/EventCustomerSent.md) - - [VoucherifySdk::EventCustomerShopifyFailed](docs/EventCustomerShopifyFailed.md) - - [VoucherifySdk::EventCustomerShopifyRecovered](docs/EventCustomerShopifyRecovered.md) - - [VoucherifySdk::EventCustomerShopifySent](docs/EventCustomerShopifySent.md) - - [VoucherifySdk::EventCustomerSmsFailed](docs/EventCustomerSmsFailed.md) - - [VoucherifySdk::EventCustomerSmsRecovered](docs/EventCustomerSmsRecovered.md) - - [VoucherifySdk::EventCustomerSmsSent](docs/EventCustomerSmsSent.md) - - [VoucherifySdk::EventCustomerUpdated](docs/EventCustomerUpdated.md) - - [VoucherifySdk::EventCustomerValidationFailed](docs/EventCustomerValidationFailed.md) - - [VoucherifySdk::EventCustomerValidationSucceeded](docs/EventCustomerValidationSucceeded.md) - - [VoucherifySdk::EventCustomerVoucherDeleted](docs/EventCustomerVoucherDeleted.md) - - [VoucherifySdk::EventCustomerVouchersLoyaltyPointsExpired](docs/EventCustomerVouchersLoyaltyPointsExpired.md) - [VoucherifySdk::EventsCreateRequestBody](docs/EventsCreateRequestBody.md) + - [VoucherifySdk::EventsCreateRequestBodyLoyalty](docs/EventsCreateRequestBodyLoyalty.md) + - [VoucherifySdk::EventsCreateRequestBodyReferral](docs/EventsCreateRequestBodyReferral.md) - [VoucherifySdk::EventsCreateResponseBody](docs/EventsCreateResponseBody.md) - [VoucherifySdk::Export](docs/Export.md) - - [VoucherifySdk::ExportBase](docs/ExportBase.md) - - [VoucherifySdk::ExportBaseResult](docs/ExportBaseResult.md) - - [VoucherifySdk::ExportCustomer](docs/ExportCustomer.md) - - [VoucherifySdk::ExportCustomerBase](docs/ExportCustomerBase.md) - - [VoucherifySdk::ExportCustomerBaseParameters](docs/ExportCustomerBaseParameters.md) - - [VoucherifySdk::ExportCustomerFields](docs/ExportCustomerFields.md) - - [VoucherifySdk::ExportCustomerOrder](docs/ExportCustomerOrder.md) - - [VoucherifySdk::ExportCustomerScheduled](docs/ExportCustomerScheduled.md) - - [VoucherifySdk::ExportOrder](docs/ExportOrder.md) - - [VoucherifySdk::ExportOrderBase](docs/ExportOrderBase.md) - [VoucherifySdk::ExportOrderFields](docs/ExportOrderFields.md) - [VoucherifySdk::ExportOrderOrder](docs/ExportOrderOrder.md) - - [VoucherifySdk::ExportOrderScheduled](docs/ExportOrderScheduled.md) - - [VoucherifySdk::ExportPointsExpiration](docs/ExportPointsExpiration.md) - - [VoucherifySdk::ExportPointsExpirationBase](docs/ExportPointsExpirationBase.md) - - [VoucherifySdk::ExportPointsExpirationBaseParameters](docs/ExportPointsExpirationBaseParameters.md) - - [VoucherifySdk::ExportPointsExpirationFields](docs/ExportPointsExpirationFields.md) - - [VoucherifySdk::ExportPointsExpirationFilters](docs/ExportPointsExpirationFilters.md) - - [VoucherifySdk::ExportPointsExpirationOrder](docs/ExportPointsExpirationOrder.md) - - [VoucherifySdk::ExportPointsExpirationScheduled](docs/ExportPointsExpirationScheduled.md) - - [VoucherifySdk::ExportPublication](docs/ExportPublication.md) - - [VoucherifySdk::ExportPublicationBase](docs/ExportPublicationBase.md) - - [VoucherifySdk::ExportPublicationBaseParameters](docs/ExportPublicationBaseParameters.md) - - [VoucherifySdk::ExportPublicationFields](docs/ExportPublicationFields.md) - - [VoucherifySdk::ExportPublicationOrder](docs/ExportPublicationOrder.md) - - [VoucherifySdk::ExportPublicationScheduled](docs/ExportPublicationScheduled.md) - - [VoucherifySdk::ExportRedemption](docs/ExportRedemption.md) - - [VoucherifySdk::ExportRedemptionBase](docs/ExportRedemptionBase.md) - - [VoucherifySdk::ExportRedemptionBaseParameters](docs/ExportRedemptionBaseParameters.md) - - [VoucherifySdk::ExportRedemptionFields](docs/ExportRedemptionFields.md) - - [VoucherifySdk::ExportRedemptionOrder](docs/ExportRedemptionOrder.md) - - [VoucherifySdk::ExportRedemptionScheduled](docs/ExportRedemptionScheduled.md) - - [VoucherifySdk::ExportScheduledBase](docs/ExportScheduledBase.md) - - [VoucherifySdk::ExportVoucher](docs/ExportVoucher.md) - - [VoucherifySdk::ExportVoucherBase](docs/ExportVoucherBase.md) - - [VoucherifySdk::ExportVoucherBaseParameters](docs/ExportVoucherBaseParameters.md) - - [VoucherifySdk::ExportVoucherFields](docs/ExportVoucherFields.md) - - [VoucherifySdk::ExportVoucherOrder](docs/ExportVoucherOrder.md) - - [VoucherifySdk::ExportVoucherScheduled](docs/ExportVoucherScheduled.md) - - [VoucherifySdk::ExportVoucherTransactions](docs/ExportVoucherTransactions.md) - - [VoucherifySdk::ExportVoucherTransactionsBase](docs/ExportVoucherTransactionsBase.md) + - [VoucherifySdk::ExportParameters](docs/ExportParameters.md) + - [VoucherifySdk::ExportParametersFilters](docs/ExportParametersFilters.md) + - [VoucherifySdk::ExportResult](docs/ExportResult.md) - [VoucherifySdk::ExportVoucherTransactionsFields](docs/ExportVoucherTransactionsFields.md) - [VoucherifySdk::ExportVoucherTransactionsFilters](docs/ExportVoucherTransactionsFilters.md) - [VoucherifySdk::ExportVoucherTransactionsOrder](docs/ExportVoucherTransactionsOrder.md) - - [VoucherifySdk::ExportVoucherTransactionsScheduled](docs/ExportVoucherTransactionsScheduled.md) - [VoucherifySdk::ExportsCreateRequestBody](docs/ExportsCreateRequestBody.md) + - [VoucherifySdk::ExportsCreateRequestBodyParameters](docs/ExportsCreateRequestBodyParameters.md) + - [VoucherifySdk::ExportsCreateRequestBodyParametersFilters](docs/ExportsCreateRequestBodyParametersFilters.md) - [VoucherifySdk::ExportsCreateResponseBody](docs/ExportsCreateResponseBody.md) + - [VoucherifySdk::ExportsCreateResponseBodyParameters](docs/ExportsCreateResponseBodyParameters.md) + - [VoucherifySdk::ExportsCreateResponseBodyParametersFilters](docs/ExportsCreateResponseBodyParametersFilters.md) - [VoucherifySdk::ExportsGetResponseBody](docs/ExportsGetResponseBody.md) + - [VoucherifySdk::ExportsGetResponseBodyParameters](docs/ExportsGetResponseBodyParameters.md) + - [VoucherifySdk::ExportsGetResponseBodyParametersFilters](docs/ExportsGetResponseBodyParametersFilters.md) + - [VoucherifySdk::ExportsGetResponseBodyResult](docs/ExportsGetResponseBodyResult.md) - [VoucherifySdk::ExportsListResponseBody](docs/ExportsListResponseBody.md) - [VoucherifySdk::FieldConditions](docs/FieldConditions.md) - [VoucherifySdk::FilterConditionsString](docs/FilterConditionsString.md) - [VoucherifySdk::FiltersCondition](docs/FiltersCondition.md) - [VoucherifySdk::Gift](docs/Gift.md) - - [VoucherifySdk::GiftCampaignVoucher](docs/GiftCampaignVoucher.md) - - [VoucherifySdk::GiveawayCampaignVoucher](docs/GiveawayCampaignVoucher.md) - [VoucherifySdk::InapplicableTo](docs/InapplicableTo.md) - [VoucherifySdk::InapplicableToResultList](docs/InapplicableToResultList.md) - [VoucherifySdk::Junction](docs/Junction.md) - - [VoucherifySdk::ListPublicationsItemBase](docs/ListPublicationsItemBase.md) - - [VoucherifySdk::ListPublicationsItemInvalid](docs/ListPublicationsItemInvalid.md) - - [VoucherifySdk::ListPublicationsItemValidMultipleVouchers](docs/ListPublicationsItemValidMultipleVouchers.md) - - [VoucherifySdk::ListPublicationsItemValidSingleVoucher](docs/ListPublicationsItemValidSingleVoucher.md) - [VoucherifySdk::ListPublicationsItemVoucher](docs/ListPublicationsItemVoucher.md) + - [VoucherifySdk::LoyaltiesCreateCampaignRequestBody](docs/LoyaltiesCreateCampaignRequestBody.md) + - [VoucherifySdk::LoyaltiesCreateCampaignResponseBody](docs/LoyaltiesCreateCampaignResponseBody.md) - [VoucherifySdk::LoyaltiesDeleteResponseBody](docs/LoyaltiesDeleteResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItem](docs/LoyaltiesEarningRulesCreateRequestBodyItem.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent](docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyalty](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemSegment](docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemSource](docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBody](docs/LoyaltiesEarningRulesCreateResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyCustomEvent](docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyalty](docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodySegment](docs/LoyaltiesEarningRulesCreateResponseBodySegment.md) + - [VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodySource](docs/LoyaltiesEarningRulesCreateResponseBodySource.md) - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBody](docs/LoyaltiesEarningRulesDisableResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyCustomEvent](docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyalty](docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodySegment](docs/LoyaltiesEarningRulesDisableResponseBodySegment.md) + - [VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodySource](docs/LoyaltiesEarningRulesDisableResponseBodySource.md) - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBody](docs/LoyaltiesEarningRulesEnableResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyCustomEvent](docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyalty](docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodySegment](docs/LoyaltiesEarningRulesEnableResponseBodySegment.md) + - [VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodySource](docs/LoyaltiesEarningRulesEnableResponseBodySource.md) - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBody](docs/LoyaltiesEarningRulesGetResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyCustomEvent](docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyalty](docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodySegment](docs/LoyaltiesEarningRulesGetResponseBodySegment.md) + - [VoucherifySdk::LoyaltiesEarningRulesGetResponseBodySource](docs/LoyaltiesEarningRulesGetResponseBodySource.md) + - [VoucherifySdk::LoyaltiesEarningRulesListResponseBody](docs/LoyaltiesEarningRulesListResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBody](docs/LoyaltiesEarningRulesUpdateRequestBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyalty](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodySource](docs/LoyaltiesEarningRulesUpdateRequestBodySource.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBody](docs/LoyaltiesEarningRulesUpdateResponseBody.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyCustomEvent](docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyalty](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodySegment](docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md) + - [VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodySource](docs/LoyaltiesEarningRulesUpdateResponseBodySource.md) + - [VoucherifySdk::LoyaltiesGetCampaignResponseBody](docs/LoyaltiesGetCampaignResponseBody.md) + - [VoucherifySdk::LoyaltiesListCampaignsResponseBody](docs/LoyaltiesListCampaignsResponseBody.md) + - [VoucherifySdk::LoyaltiesListMembersResponseBody](docs/LoyaltiesListMembersResponseBody.md) - [VoucherifySdk::LoyaltiesLoyaltyTierReward](docs/LoyaltiesLoyaltyTierReward.md) + - [VoucherifySdk::LoyaltiesMemberActivityListResponseBody](docs/LoyaltiesMemberActivityListResponseBody.md) - [VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody](docs/LoyaltiesMembersBalanceUpdateRequestBody.md) - [VoucherifySdk::LoyaltiesMembersBalanceUpdateResponseBody](docs/LoyaltiesMembersBalanceUpdateResponseBody.md) - [VoucherifySdk::LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject](docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) + - [VoucherifySdk::LoyaltiesMembersCreateRequestBody](docs/LoyaltiesMembersCreateRequestBody.md) + - [VoucherifySdk::LoyaltiesMembersCreateResponseBody](docs/LoyaltiesMembersCreateResponseBody.md) + - [VoucherifySdk::LoyaltiesMembersCreateResponseBodyLoyaltyCard](docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md) + - [VoucherifySdk::LoyaltiesMembersCreateResponseBodyPublish](docs/LoyaltiesMembersCreateResponseBodyPublish.md) + - [VoucherifySdk::LoyaltiesMembersCreateResponseBodyRedemption](docs/LoyaltiesMembersCreateResponseBodyRedemption.md) + - [VoucherifySdk::LoyaltiesMembersGetResponseBody](docs/LoyaltiesMembersGetResponseBody.md) + - [VoucherifySdk::LoyaltiesMembersGetResponseBodyLoyaltyCard](docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md) + - [VoucherifySdk::LoyaltiesMembersGetResponseBodyPublish](docs/LoyaltiesMembersGetResponseBodyPublish.md) + - [VoucherifySdk::LoyaltiesMembersGetResponseBodyRedemption](docs/LoyaltiesMembersGetResponseBodyRedemption.md) - [VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBody](docs/LoyaltiesMembersPointsExpirationListResponseBody.md) - [VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBodyDataItem](docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) - [VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket](docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md) - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody](docs/LoyaltiesMembersRedemptionRedeemRequestBody.md) - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBodyReward](docs/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md) - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBody](docs/LoyaltiesMembersRedemptionRedeemResponseBody.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyChannel](docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyGift](docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard](docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions](docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem](docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem](docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucher](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md) + - [VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md) - [VoucherifySdk::LoyaltiesMembersRewardsListResponseBody](docs/LoyaltiesMembersRewardsListResponseBody.md) - [VoucherifySdk::LoyaltiesMembersRewardsListResponseBodyDataItem](docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md) - [VoucherifySdk::LoyaltiesMembersTiersListResponseBody](docs/LoyaltiesMembersTiersListResponseBody.md) - [VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody](docs/LoyaltiesMembersTransactionsExportCreateRequestBody.md) - [VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBodyParameters](docs/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) - [VoucherifySdk::LoyaltiesMembersTransactionsExportCreateResponseBody](docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md) + - [VoucherifySdk::LoyaltiesMembersTransactionsExportCreateResponseBodyParameters](docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md) - [VoucherifySdk::LoyaltiesMembersTransactionsListResponseBody](docs/LoyaltiesMembersTransactionsListResponseBody.md) - [VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBody](docs/LoyaltiesMembersTransfersCreateResponseBody.md) - [VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssets](docs/LoyaltiesMembersTransfersCreateResponseBodyAssets.md) @@ -615,58 +676,130 @@ Class | Method | HTTP request | Description - [VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard](docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) - [VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyPublish](docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md) - [VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyRedemption](docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md) - - [VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe](docs/LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBody](docs/LoyaltiesPointsExpirationExportCreateRequestBody.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParameters](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBody](docs/LoyaltiesPointsExpirationExportCreateResponseBody.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParameters](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md) + - [VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md) - [VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBody](docs/LoyaltiesRewardAssignmentsGetResponseBody.md) + - [VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBodyParameters](docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md) + - [VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty](docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md) + - [VoucherifySdk::LoyaltiesRewardAssignmentsListResponseBody](docs/LoyaltiesRewardAssignmentsListResponseBody.md) - [VoucherifySdk::LoyaltiesRewardAssignmentsRewardGetResponseBody](docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md) + - [VoucherifySdk::LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes](docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md) + - [VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBody](docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md) + - [VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters](docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md) + - [VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty](docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md) + - [VoucherifySdk::LoyaltiesRewardsCreateAssignmentResponseBody](docs/LoyaltiesRewardsCreateAssignmentResponseBody.md) + - [VoucherifySdk::LoyaltiesRewardsCreateAssignmentResponseBodyParameters](docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md) + - [VoucherifySdk::LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty](docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md) - [VoucherifySdk::LoyaltiesRewardsGetResponseBody](docs/LoyaltiesRewardsGetResponseBody.md) + - [VoucherifySdk::LoyaltiesRewardsGetResponseBodyParameters](docs/LoyaltiesRewardsGetResponseBodyParameters.md) + - [VoucherifySdk::LoyaltiesRewardsGetResponseBodyParametersLoyalty](docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md) + - [VoucherifySdk::LoyaltiesRewardsListAssignmentsResponseBody](docs/LoyaltiesRewardsListAssignmentsResponseBody.md) + - [VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBody](docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md) + - [VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBodyParameters](docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md) + - [VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty](docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md) + - [VoucherifySdk::LoyaltiesRewardsUpdateAssignmentResponseBody](docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md) + - [VoucherifySdk::LoyaltiesRewardsUpdateAssignmentResponseBodyParameters](docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md) + - [VoucherifySdk::LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty](docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md) - [VoucherifySdk::LoyaltiesTiersCreateInBulkRequestBodyItem](docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md) - [VoucherifySdk::LoyaltiesTiersEarningRulesListResponseBody](docs/LoyaltiesTiersEarningRulesListResponseBody.md) - [VoucherifySdk::LoyaltiesTiersGetResponseBody](docs/LoyaltiesTiersGetResponseBody.md) + - [VoucherifySdk::LoyaltiesTiersGetResponseBodyConfig](docs/LoyaltiesTiersGetResponseBodyConfig.md) + - [VoucherifySdk::LoyaltiesTiersGetResponseBodyConfigPoints](docs/LoyaltiesTiersGetResponseBodyConfigPoints.md) + - [VoucherifySdk::LoyaltiesTiersGetResponseBodyPoints](docs/LoyaltiesTiersGetResponseBodyPoints.md) - [VoucherifySdk::LoyaltiesTiersListResponseBody](docs/LoyaltiesTiersListResponseBody.md) - [VoucherifySdk::LoyaltiesTiersRewardsListResponseBody](docs/LoyaltiesTiersRewardsListResponseBody.md) - [VoucherifySdk::LoyaltiesTransferPoints](docs/LoyaltiesTransferPoints.md) + - [VoucherifySdk::LoyaltiesUpdateCampaignRequestBody](docs/LoyaltiesUpdateCampaignRequestBody.md) + - [VoucherifySdk::LoyaltiesUpdateCampaignRequestBodyOptions](docs/LoyaltiesUpdateCampaignRequestBodyOptions.md) + - [VoucherifySdk::LoyaltiesUpdateCampaignResponseBody](docs/LoyaltiesUpdateCampaignResponseBody.md) + - [VoucherifySdk::LoyaltyCampaign](docs/LoyaltyCampaign.md) + - [VoucherifySdk::LoyaltyCampaignVoucher](docs/LoyaltyCampaignVoucher.md) + - [VoucherifySdk::LoyaltyCampaignVoucherRedemption](docs/LoyaltyCampaignVoucherRedemption.md) - [VoucherifySdk::LoyaltyCardTransaction](docs/LoyaltyCardTransaction.md) + - [VoucherifySdk::LoyaltyCardTransactionDetails](docs/LoyaltyCardTransactionDetails.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsBalance](docs/LoyaltyCardTransactionDetailsBalance.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsBalanceRelatedObject](docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsCustomEvent](docs/LoyaltyCardTransactionDetailsCustomEvent.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsEarningRule](docs/LoyaltyCardTransactionDetailsEarningRule.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsEarningRuleSource](docs/LoyaltyCardTransactionDetailsEarningRuleSource.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsEvent](docs/LoyaltyCardTransactionDetailsEvent.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsEventSchema](docs/LoyaltyCardTransactionDetailsEventSchema.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsLoyaltyTier](docs/LoyaltyCardTransactionDetailsLoyaltyTier.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsOrder](docs/LoyaltyCardTransactionDetailsOrder.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsRedemption](docs/LoyaltyCardTransactionDetailsRedemption.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsReward](docs/LoyaltyCardTransactionDetailsReward.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsRollback](docs/LoyaltyCardTransactionDetailsRollback.md) + - [VoucherifySdk::LoyaltyCardTransactionDetailsSegment](docs/LoyaltyCardTransactionDetailsSegment.md) - [VoucherifySdk::LoyaltyCardTransactionsType](docs/LoyaltyCardTransactionsType.md) + - [VoucherifySdk::LoyaltyMember](docs/LoyaltyMember.md) + - [VoucherifySdk::LoyaltyMemberLoyaltyCard](docs/LoyaltyMemberLoyaltyCard.md) + - [VoucherifySdk::LoyaltyMemberPublish](docs/LoyaltyMemberPublish.md) + - [VoucherifySdk::LoyaltyMemberRedemption](docs/LoyaltyMemberRedemption.md) - [VoucherifySdk::LoyaltyTier](docs/LoyaltyTier.md) - - [VoucherifySdk::LoyaltyTierAllOfConfig](docs/LoyaltyTierAllOfConfig.md) - - [VoucherifySdk::LoyaltyTierAllOfConfigPoints](docs/LoyaltyTierAllOfConfigPoints.md) - [VoucherifySdk::LoyaltyTierBase](docs/LoyaltyTierBase.md) - [VoucherifySdk::LoyaltyTierBasePoints](docs/LoyaltyTierBasePoints.md) + - [VoucherifySdk::LoyaltyTierConfig](docs/LoyaltyTierConfig.md) + - [VoucherifySdk::LoyaltyTierConfigPoints](docs/LoyaltyTierConfigPoints.md) - [VoucherifySdk::LoyaltyTierExpiration](docs/LoyaltyTierExpiration.md) + - [VoucherifySdk::LoyaltyTierPoints](docs/LoyaltyTierPoints.md) - [VoucherifySdk::LoyaltyTiersExpirationAll](docs/LoyaltyTiersExpirationAll.md) - [VoucherifySdk::LoyaltyTiersExpirationAllExpirationDate](docs/LoyaltyTiersExpirationAllExpirationDate.md) - [VoucherifySdk::LoyaltyTiersExpirationAllExpirationDateRounding](docs/LoyaltyTiersExpirationAllExpirationDateRounding.md) - [VoucherifySdk::LoyaltyTiersExpirationAllStartDate](docs/LoyaltyTiersExpirationAllStartDate.md) - [VoucherifySdk::LuckyDraw](docs/LuckyDraw.md) - - [VoucherifySdk::MappingFixed](docs/MappingFixed.md) - - [VoucherifySdk::MappingMultiply](docs/MappingMultiply.md) - [VoucherifySdk::MappingPoints](docs/MappingPoints.md) + - [VoucherifySdk::MemberActivity](docs/MemberActivity.md) - [VoucherifySdk::Order](docs/Order.md) - - [VoucherifySdk::OrderBase](docs/OrderBase.md) - [VoucherifySdk::OrderCalculated](docs/OrderCalculated.md) - - [VoucherifySdk::OrderCalculatedBase](docs/OrderCalculatedBase.md) - - [VoucherifySdk::OrderCalculatedCustomer](docs/OrderCalculatedCustomer.md) - - [VoucherifySdk::OrderCalculatedNoCustomerData](docs/OrderCalculatedNoCustomerData.md) - - [VoucherifySdk::OrderCalculatedReferrer](docs/OrderCalculatedReferrer.md) + - [VoucherifySdk::OrderCalculatedItem](docs/OrderCalculatedItem.md) + - [VoucherifySdk::OrderCalculatedItemProduct](docs/OrderCalculatedItemProduct.md) + - [VoucherifySdk::OrderCalculatedItemSku](docs/OrderCalculatedItemSku.md) - [VoucherifySdk::OrderItem](docs/OrderItem.md) - - [VoucherifySdk::OrderItemCalculated](docs/OrderItemCalculated.md) - [VoucherifySdk::OrderItemProduct](docs/OrderItemProduct.md) - [VoucherifySdk::OrderItemSku](docs/OrderItemSku.md) - - [VoucherifySdk::OrderRedemptions](docs/OrderRedemptions.md) + - [VoucherifySdk::OrderRedemptionsEntry](docs/OrderRedemptionsEntry.md) - [VoucherifySdk::OrdersCreateRequestBody](docs/OrdersCreateRequestBody.md) - [VoucherifySdk::OrdersCreateResponseBody](docs/OrdersCreateResponseBody.md) - [VoucherifySdk::OrdersExportCreateRequestBody](docs/OrdersExportCreateRequestBody.md) - [VoucherifySdk::OrdersExportCreateRequestBodyParameters](docs/OrdersExportCreateRequestBodyParameters.md) - [VoucherifySdk::OrdersExportCreateResponseBody](docs/OrdersExportCreateResponseBody.md) + - [VoucherifySdk::OrdersExportCreateResponseBodyParameters](docs/OrdersExportCreateResponseBodyParameters.md) - [VoucherifySdk::OrdersGetResponseBody](docs/OrdersGetResponseBody.md) - [VoucherifySdk::OrdersImportCreateRequestBodyItem](docs/OrdersImportCreateRequestBodyItem.md) - [VoucherifySdk::OrdersImportCreateResponseBody](docs/OrdersImportCreateResponseBody.md) - [VoucherifySdk::OrdersListResponseBody](docs/OrdersListResponseBody.md) - [VoucherifySdk::OrdersUpdateRequestBody](docs/OrdersUpdateRequestBody.md) - [VoucherifySdk::OrdersUpdateResponseBody](docs/OrdersUpdateResponseBody.md) + - [VoucherifySdk::ParameterActivityCategory](docs/ParameterActivityCategory.md) - [VoucherifySdk::ParameterCampaignType](docs/ParameterCampaignType.md) - [VoucherifySdk::ParameterCreatedBeforeAfter](docs/ParameterCreatedBeforeAfter.md) - [VoucherifySdk::ParameterExpandListCampaigns](docs/ParameterExpandListCampaigns.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemables](docs/ParameterFiltersListCustomerRedeemables.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesCampaignId](docs/ParameterFiltersListCustomerRedeemablesCampaignId.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesCampaignType](docs/ParameterFiltersListCustomerRedeemablesCampaignType.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesCampaignTypeConditions](docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesCreatedAt](docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesCreatedAtConditions](docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesHolderRole](docs/ParameterFiltersListCustomerRedeemablesHolderRole.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesHolderRoleConditions](docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesId](docs/ParameterFiltersListCustomerRedeemablesId.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesRedeemableId](docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesRedeemableObject](docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions](docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesVoucherType](docs/ParameterFiltersListCustomerRedeemablesVoucherType.md) + - [VoucherifySdk::ParameterFiltersListCustomerRedeemablesVoucherTypeConditions](docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md) - [VoucherifySdk::ParameterFiltersListRedemptions](docs/ParameterFiltersListRedemptions.md) - [VoucherifySdk::ParameterFiltersListRedemptionsCampaignName](docs/ParameterFiltersListRedemptionsCampaignName.md) - [VoucherifySdk::ParameterFiltersListRedemptionsCustomerId](docs/ParameterFiltersListRedemptionsCustomerId.md) @@ -679,35 +812,42 @@ Class | Method | HTTP request | Description - [VoucherifySdk::ParameterFiltersListRedemptionsUserLogin](docs/ParameterFiltersListRedemptionsUserLogin.md) - [VoucherifySdk::ParameterFiltersListRedemptionsVoucherCode](docs/ParameterFiltersListRedemptionsVoucherCode.md) - [VoucherifySdk::ParameterOrder](docs/ParameterOrder.md) + - [VoucherifySdk::ParameterOrderCreatedAt](docs/ParameterOrderCreatedAt.md) - [VoucherifySdk::ParameterOrderListAllPromotionStacks](docs/ParameterOrderListAllPromotionStacks.md) - [VoucherifySdk::ParameterOrderListCampaigns](docs/ParameterOrderListCampaigns.md) - [VoucherifySdk::ParameterOrderListCustomers](docs/ParameterOrderListCustomers.md) + - [VoucherifySdk::ParameterOrderListEarningRules](docs/ParameterOrderListEarningRules.md) - [VoucherifySdk::ParameterOrderListExports](docs/ParameterOrderListExports.md) - [VoucherifySdk::ParameterOrderListLoyaltyTiers](docs/ParameterOrderListLoyaltyTiers.md) - [VoucherifySdk::ParameterOrderListOrders](docs/ParameterOrderListOrders.md) + - [VoucherifySdk::ParameterOrderListPromotionTiers](docs/ParameterOrderListPromotionTiers.md) + - [VoucherifySdk::ParameterOrderListPromotionTiersClientSide](docs/ParameterOrderListPromotionTiersClientSide.md) - [VoucherifySdk::ParameterOrderListPublications](docs/ParameterOrderListPublications.md) + - [VoucherifySdk::ParameterOrderListRedeemables](docs/ParameterOrderListRedeemables.md) - [VoucherifySdk::ParameterOrderListRedemptions](docs/ParameterOrderListRedemptions.md) - [VoucherifySdk::ParameterOrderListValidationRuleAssignments](docs/ParameterOrderListValidationRuleAssignments.md) - [VoucherifySdk::ParameterOrderListValidationRules](docs/ParameterOrderListValidationRules.md) + - [VoucherifySdk::ParameterOrderVouchers](docs/ParameterOrderVouchers.md) - [VoucherifySdk::ParameterResultListPublications](docs/ParameterResultListPublications.md) - [VoucherifySdk::ParameterUpdatedBeforeAfter](docs/ParameterUpdatedBeforeAfter.md) - [VoucherifySdk::ParameterVoucherTypeListPublications](docs/ParameterVoucherTypeListPublications.md) - [VoucherifySdk::PointsExpirationTypes](docs/PointsExpirationTypes.md) - [VoucherifySdk::Product](docs/Product.md) - - [VoucherifySdk::ProductCollectionsCreateDynamicRequestBody](docs/ProductCollectionsCreateDynamicRequestBody.md) - - [VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyFilter](docs/ProductCollectionsCreateDynamicRequestBodyFilter.md) - - [VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyProductsItem](docs/ProductCollectionsCreateDynamicRequestBodyProductsItem.md) - [VoucherifySdk::ProductCollectionsCreateRequestBody](docs/ProductCollectionsCreateRequestBody.md) + - [VoucherifySdk::ProductCollectionsCreateRequestBodyFilter](docs/ProductCollectionsCreateRequestBodyFilter.md) + - [VoucherifySdk::ProductCollectionsCreateRequestBodyProductsItem](docs/ProductCollectionsCreateRequestBodyProductsItem.md) - [VoucherifySdk::ProductCollectionsCreateResponseBody](docs/ProductCollectionsCreateResponseBody.md) - - [VoucherifySdk::ProductCollectionsCreateStaticRequestBody](docs/ProductCollectionsCreateStaticRequestBody.md) + - [VoucherifySdk::ProductCollectionsCreateResponseBodyFilter](docs/ProductCollectionsCreateResponseBodyFilter.md) + - [VoucherifySdk::ProductCollectionsCreateResponseBodyProductsItem](docs/ProductCollectionsCreateResponseBodyProductsItem.md) - [VoucherifySdk::ProductCollectionsGetResponseBody](docs/ProductCollectionsGetResponseBody.md) + - [VoucherifySdk::ProductCollectionsGetResponseBodyFilter](docs/ProductCollectionsGetResponseBodyFilter.md) + - [VoucherifySdk::ProductCollectionsGetResponseBodyProductsItem](docs/ProductCollectionsGetResponseBodyProductsItem.md) - [VoucherifySdk::ProductCollectionsItem](docs/ProductCollectionsItem.md) + - [VoucherifySdk::ProductCollectionsItemFilter](docs/ProductCollectionsItemFilter.md) - [VoucherifySdk::ProductCollectionsItemProductsItem](docs/ProductCollectionsItemProductsItem.md) - - [VoucherifySdk::ProductCollectionsList](docs/ProductCollectionsList.md) - [VoucherifySdk::ProductCollectionsListResponseBody](docs/ProductCollectionsListResponseBody.md) - - [VoucherifySdk::ProductCollectionsProductsList](docs/ProductCollectionsProductsList.md) - - [VoucherifySdk::ProductCollectionsProductsListProductsItem](docs/ProductCollectionsProductsListProductsItem.md) - [VoucherifySdk::ProductCollectionsProductsListResponseBody](docs/ProductCollectionsProductsListResponseBody.md) + - [VoucherifySdk::ProductCollectionsProductsListResponseBodyDataItem](docs/ProductCollectionsProductsListResponseBodyDataItem.md) - [VoucherifySdk::ProductWithoutSkus](docs/ProductWithoutSkus.md) - [VoucherifySdk::ProductsCreateRequestBody](docs/ProductsCreateRequestBody.md) - [VoucherifySdk::ProductsCreateResponseBody](docs/ProductsCreateResponseBody.md) @@ -728,186 +868,317 @@ Class | Method | HTTP request | Description - [VoucherifySdk::PromotionStack](docs/PromotionStack.md) - [VoucherifySdk::PromotionStackBase](docs/PromotionStackBase.md) - [VoucherifySdk::PromotionStackBaseTiers](docs/PromotionStackBaseTiers.md) + - [VoucherifySdk::PromotionStackTiers](docs/PromotionStackTiers.md) - [VoucherifySdk::PromotionTier](docs/PromotionTier.md) - [VoucherifySdk::PromotionTierAction](docs/PromotionTierAction.md) - [VoucherifySdk::PromotionTierCampaign](docs/PromotionTierCampaign.md) - - [VoucherifySdk::PromotionTierCampaignValidityTimeframe](docs/PromotionTierCampaignValidityTimeframe.md) - [VoucherifySdk::PromotionTierCreateParams](docs/PromotionTierCreateParams.md) + - [VoucherifySdk::PromotionTierCreateParamsAction](docs/PromotionTierCreateParamsAction.md) - [VoucherifySdk::PromotionTierSummary](docs/PromotionTierSummary.md) - [VoucherifySdk::PromotionTierSummaryOrders](docs/PromotionTierSummaryOrders.md) - [VoucherifySdk::PromotionTierSummaryRedemptions](docs/PromotionTierSummaryRedemptions.md) - - [VoucherifySdk::PromotionTierValidityTimeframe](docs/PromotionTierValidityTimeframe.md) - [VoucherifySdk::PromotionTiersList](docs/PromotionTiersList.md) - [VoucherifySdk::PromotionsStacksCreateRequestBody](docs/PromotionsStacksCreateRequestBody.md) + - [VoucherifySdk::PromotionsStacksCreateRequestBodyTiers](docs/PromotionsStacksCreateRequestBodyTiers.md) - [VoucherifySdk::PromotionsStacksCreateResponseBody](docs/PromotionsStacksCreateResponseBody.md) + - [VoucherifySdk::PromotionsStacksCreateResponseBodyTiers](docs/PromotionsStacksCreateResponseBodyTiers.md) - [VoucherifySdk::PromotionsStacksGetResponseBody](docs/PromotionsStacksGetResponseBody.md) + - [VoucherifySdk::PromotionsStacksGetResponseBodyTiers](docs/PromotionsStacksGetResponseBodyTiers.md) - [VoucherifySdk::PromotionsStacksListResponseBody](docs/PromotionsStacksListResponseBody.md) - [VoucherifySdk::PromotionsStacksUpdateRequestBody](docs/PromotionsStacksUpdateRequestBody.md) - [VoucherifySdk::PromotionsStacksUpdateRequestBodyTiers](docs/PromotionsStacksUpdateRequestBodyTiers.md) - [VoucherifySdk::PromotionsStacksUpdateResponseBody](docs/PromotionsStacksUpdateResponseBody.md) + - [VoucherifySdk::PromotionsStacksUpdateResponseBodyTiers](docs/PromotionsStacksUpdateResponseBodyTiers.md) + - [VoucherifySdk::PromotionsTiersCreateRequestBody](docs/PromotionsTiersCreateRequestBody.md) + - [VoucherifySdk::PromotionsTiersCreateRequestBodyAction](docs/PromotionsTiersCreateRequestBodyAction.md) + - [VoucherifySdk::PromotionsTiersCreateResponseBody](docs/PromotionsTiersCreateResponseBody.md) + - [VoucherifySdk::PromotionsTiersCreateResponseBodyAction](docs/PromotionsTiersCreateResponseBodyAction.md) + - [VoucherifySdk::PromotionsTiersCreateResponseBodyCampaign](docs/PromotionsTiersCreateResponseBodyCampaign.md) + - [VoucherifySdk::PromotionsTiersCreateResponseBodySummary](docs/PromotionsTiersCreateResponseBodySummary.md) + - [VoucherifySdk::PromotionsTiersCreateResponseBodySummaryOrders](docs/PromotionsTiersCreateResponseBodySummaryOrders.md) + - [VoucherifySdk::PromotionsTiersCreateResponseBodySummaryRedemptions](docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md) - [VoucherifySdk::PromotionsTiersDisableResponseBody](docs/PromotionsTiersDisableResponseBody.md) + - [VoucherifySdk::PromotionsTiersDisableResponseBodyAction](docs/PromotionsTiersDisableResponseBodyAction.md) + - [VoucherifySdk::PromotionsTiersDisableResponseBodyCampaign](docs/PromotionsTiersDisableResponseBodyCampaign.md) + - [VoucherifySdk::PromotionsTiersDisableResponseBodySummary](docs/PromotionsTiersDisableResponseBodySummary.md) + - [VoucherifySdk::PromotionsTiersDisableResponseBodySummaryOrders](docs/PromotionsTiersDisableResponseBodySummaryOrders.md) + - [VoucherifySdk::PromotionsTiersDisableResponseBodySummaryRedemptions](docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md) - [VoucherifySdk::PromotionsTiersEnableResponseBody](docs/PromotionsTiersEnableResponseBody.md) + - [VoucherifySdk::PromotionsTiersEnableResponseBodyAction](docs/PromotionsTiersEnableResponseBodyAction.md) + - [VoucherifySdk::PromotionsTiersEnableResponseBodyCampaign](docs/PromotionsTiersEnableResponseBodyCampaign.md) + - [VoucherifySdk::PromotionsTiersEnableResponseBodySummary](docs/PromotionsTiersEnableResponseBodySummary.md) + - [VoucherifySdk::PromotionsTiersEnableResponseBodySummaryOrders](docs/PromotionsTiersEnableResponseBodySummaryOrders.md) + - [VoucherifySdk::PromotionsTiersEnableResponseBodySummaryRedemptions](docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md) - [VoucherifySdk::PromotionsTiersGetResponseBody](docs/PromotionsTiersGetResponseBody.md) + - [VoucherifySdk::PromotionsTiersGetResponseBodyAction](docs/PromotionsTiersGetResponseBodyAction.md) + - [VoucherifySdk::PromotionsTiersGetResponseBodyCampaign](docs/PromotionsTiersGetResponseBodyCampaign.md) + - [VoucherifySdk::PromotionsTiersGetResponseBodySummary](docs/PromotionsTiersGetResponseBodySummary.md) + - [VoucherifySdk::PromotionsTiersGetResponseBodySummaryOrders](docs/PromotionsTiersGetResponseBodySummaryOrders.md) + - [VoucherifySdk::PromotionsTiersGetResponseBodySummaryRedemptions](docs/PromotionsTiersGetResponseBodySummaryRedemptions.md) - [VoucherifySdk::PromotionsTiersListResponseBody](docs/PromotionsTiersListResponseBody.md) - - [VoucherifySdk::PropertiesForLoyaltyCampaignOptions](docs/PropertiesForLoyaltyCampaignOptions.md) - - [VoucherifySdk::PublicationsCreateBaseResponseBody](docs/PublicationsCreateBaseResponseBody.md) + - [VoucherifySdk::PromotionsTiersUpdateRequestBody](docs/PromotionsTiersUpdateRequestBody.md) + - [VoucherifySdk::PromotionsTiersUpdateRequestBodyAction](docs/PromotionsTiersUpdateRequestBodyAction.md) + - [VoucherifySdk::PromotionsTiersUpdateResponseBody](docs/PromotionsTiersUpdateResponseBody.md) + - [VoucherifySdk::PromotionsTiersUpdateResponseBodyAction](docs/PromotionsTiersUpdateResponseBodyAction.md) + - [VoucherifySdk::PromotionsTiersUpdateResponseBodyCampaign](docs/PromotionsTiersUpdateResponseBodyCampaign.md) + - [VoucherifySdk::PromotionsTiersUpdateResponseBodySummary](docs/PromotionsTiersUpdateResponseBodySummary.md) + - [VoucherifySdk::PromotionsTiersUpdateResponseBodySummaryOrders](docs/PromotionsTiersUpdateResponseBodySummaryOrders.md) + - [VoucherifySdk::PromotionsTiersUpdateResponseBodySummaryRedemptions](docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md) - [VoucherifySdk::PublicationsCreateRequestBody](docs/PublicationsCreateRequestBody.md) + - [VoucherifySdk::PublicationsCreateRequestBodyCustomer](docs/PublicationsCreateRequestBodyCustomer.md) + - [VoucherifySdk::PublicationsCreateRequestBodyCustomerAddress](docs/PublicationsCreateRequestBodyCustomerAddress.md) - [VoucherifySdk::PublicationsCreateResponseBody](docs/PublicationsCreateResponseBody.md) - - [VoucherifySdk::PublicationsCreateVoucherResponseBody](docs/PublicationsCreateVoucherResponseBody.md) - - [VoucherifySdk::PublicationsCreateVouchersResponseBody](docs/PublicationsCreateVouchersResponseBody.md) - [VoucherifySdk::PublicationsListResponseBody](docs/PublicationsListResponseBody.md) - [VoucherifySdk::PublicationsListResponseBodyPublicationsItem](docs/PublicationsListResponseBodyPublicationsItem.md) + - [VoucherifySdk::PublicationsListResponseBodyPublicationsItemMetadata](docs/PublicationsListResponseBodyPublicationsItemMetadata.md) - [VoucherifySdk::QualificationsCheckEligibilityRequestBody](docs/QualificationsCheckEligibilityRequestBody.md) - [VoucherifySdk::QualificationsCheckEligibilityResponseBody](docs/QualificationsCheckEligibilityResponseBody.md) - [VoucherifySdk::QualificationsFieldConditions](docs/QualificationsFieldConditions.md) - [VoucherifySdk::QualificationsFiltersCondition](docs/QualificationsFiltersCondition.md) - [VoucherifySdk::QualificationsOption](docs/QualificationsOption.md) - [VoucherifySdk::QualificationsOptionFilters](docs/QualificationsOptionFilters.md) + - [VoucherifySdk::QualificationsOptionFiltersCampaignType](docs/QualificationsOptionFiltersCampaignType.md) + - [VoucherifySdk::QualificationsOptionFiltersCampaignTypeConditions](docs/QualificationsOptionFiltersCampaignTypeConditions.md) + - [VoucherifySdk::QualificationsOptionFiltersHolderRole](docs/QualificationsOptionFiltersHolderRole.md) + - [VoucherifySdk::QualificationsOptionFiltersHolderRoleConditions](docs/QualificationsOptionFiltersHolderRoleConditions.md) - [VoucherifySdk::QualificationsOptionFiltersResourceType](docs/QualificationsOptionFiltersResourceType.md) - [VoucherifySdk::QualificationsOptionFiltersResourceTypeConditions](docs/QualificationsOptionFiltersResourceTypeConditions.md) - [VoucherifySdk::QualificationsRedeemable](docs/QualificationsRedeemable.md) - [VoucherifySdk::QualificationsRedeemableBase](docs/QualificationsRedeemableBase.md) - [VoucherifySdk::QualificationsRedeemables](docs/QualificationsRedeemables.md) - - [VoucherifySdk::RedeemGiftCard](docs/RedeemGiftCard.md) - - [VoucherifySdk::RedeemGiftCardAllOfGift](docs/RedeemGiftCardAllOfGift.md) - - [VoucherifySdk::RedeemLoyaltyCard](docs/RedeemLoyaltyCard.md) - - [VoucherifySdk::RedeemLoyaltyCardAllOfReward](docs/RedeemLoyaltyCardAllOfReward.md) - - [VoucherifySdk::RedeemPromotionStack](docs/RedeemPromotionStack.md) - - [VoucherifySdk::RedeemPromotionTier](docs/RedeemPromotionTier.md) - - [VoucherifySdk::RedeemVoucher](docs/RedeemVoucher.md) - [VoucherifySdk::RedeemableGift](docs/RedeemableGift.md) - [VoucherifySdk::RedeemableLoyaltyCard](docs/RedeemableLoyaltyCard.md) - [VoucherifySdk::RedeemableResult](docs/RedeemableResult.md) - - [VoucherifySdk::RedeemableResultGiftCard](docs/RedeemableResultGiftCard.md) - - [VoucherifySdk::RedeemableResultGiftCardGift](docs/RedeemableResultGiftCardGift.md) - - [VoucherifySdk::RedeemableResultLoyaltyCard](docs/RedeemableResultLoyaltyCard.md) - - [VoucherifySdk::RedeemableResultLoyaltyCardLoyaltyCard](docs/RedeemableResultLoyaltyCardLoyaltyCard.md) - - [VoucherifySdk::RedeemableResultPromotionStack](docs/RedeemableResultPromotionStack.md) - - [VoucherifySdk::RedeemableResultPromotionTier](docs/RedeemableResultPromotionTier.md) - - [VoucherifySdk::RedeemableResultPromotionTierDiscount](docs/RedeemableResultPromotionTierDiscount.md) - - [VoucherifySdk::RedeemableResultVoucherCode](docs/RedeemableResultVoucherCode.md) + - [VoucherifySdk::RedeemableVoucher](docs/RedeemableVoucher.md) + - [VoucherifySdk::RedeemableVoucherGift](docs/RedeemableVoucherGift.md) + - [VoucherifySdk::RedeemableVoucherLoyaltyCard](docs/RedeemableVoucherLoyaltyCard.md) + - [VoucherifySdk::RedeemableVoucherPublish](docs/RedeemableVoucherPublish.md) + - [VoucherifySdk::RedeemableVoucherRedemption](docs/RedeemableVoucherRedemption.md) - [VoucherifySdk::Redemption](docs/Redemption.md) - [VoucherifySdk::RedemptionChannel](docs/RedemptionChannel.md) + - [VoucherifySdk::RedemptionEntry](docs/RedemptionEntry.md) + - [VoucherifySdk::RedemptionEntryChannel](docs/RedemptionEntryChannel.md) + - [VoucherifySdk::RedemptionEntryCustomer](docs/RedemptionEntryCustomer.md) + - [VoucherifySdk::RedemptionEntryGift](docs/RedemptionEntryGift.md) + - [VoucherifySdk::RedemptionEntryLoyaltyCard](docs/RedemptionEntryLoyaltyCard.md) + - [VoucherifySdk::RedemptionEntryOrder](docs/RedemptionEntryOrder.md) + - [VoucherifySdk::RedemptionEntryOrderCustomer](docs/RedemptionEntryOrderCustomer.md) + - [VoucherifySdk::RedemptionEntryOrderReferrer](docs/RedemptionEntryOrderReferrer.md) + - [VoucherifySdk::RedemptionEntryPromotionTier](docs/RedemptionEntryPromotionTier.md) + - [VoucherifySdk::RedemptionEntryPromotionTierAction](docs/RedemptionEntryPromotionTierAction.md) + - [VoucherifySdk::RedemptionEntryPromotionTierCampaign](docs/RedemptionEntryPromotionTierCampaign.md) + - [VoucherifySdk::RedemptionEntryPromotionTierSummary](docs/RedemptionEntryPromotionTierSummary.md) + - [VoucherifySdk::RedemptionEntryPromotionTierSummaryOrders](docs/RedemptionEntryPromotionTierSummaryOrders.md) + - [VoucherifySdk::RedemptionEntryPromotionTierSummaryRedemptions](docs/RedemptionEntryPromotionTierSummaryRedemptions.md) + - [VoucherifySdk::RedemptionEntryRelatedRedemptions](docs/RedemptionEntryRelatedRedemptions.md) + - [VoucherifySdk::RedemptionEntryRelatedRedemptionsRedemptionsItem](docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md) + - [VoucherifySdk::RedemptionEntryRelatedRedemptionsRollbacksItem](docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md) + - [VoucherifySdk::RedemptionEntryVoucher](docs/RedemptionEntryVoucher.md) + - [VoucherifySdk::RedemptionEntryVoucherGift](docs/RedemptionEntryVoucherGift.md) + - [VoucherifySdk::RedemptionEntryVoucherLoyaltyCard](docs/RedemptionEntryVoucherLoyaltyCard.md) + - [VoucherifySdk::RedemptionEntryVoucherPublish](docs/RedemptionEntryVoucherPublish.md) + - [VoucherifySdk::RedemptionEntryVoucherRedemption](docs/RedemptionEntryVoucherRedemption.md) - [VoucherifySdk::RedemptionGift](docs/RedemptionGift.md) - - [VoucherifySdk::RedemptionInternal](docs/RedemptionInternal.md) - - [VoucherifySdk::RedemptionInternalRelatedRedemptions](docs/RedemptionInternalRelatedRedemptions.md) - - [VoucherifySdk::RedemptionInternalRelatedRedemptionsItem](docs/RedemptionInternalRelatedRedemptionsItem.md) - - [VoucherifySdk::RedemptionInternalRelatedRedemptionsRollbacksItem](docs/RedemptionInternalRelatedRedemptionsRollbacksItem.md) - [VoucherifySdk::RedemptionLoyaltyCard](docs/RedemptionLoyaltyCard.md) - [VoucherifySdk::RedemptionRelatedRedemptions](docs/RedemptionRelatedRedemptions.md) - - [VoucherifySdk::RedemptionRelatedRedemptionsItem](docs/RedemptionRelatedRedemptionsItem.md) + - [VoucherifySdk::RedemptionRelatedRedemptionsRedemptionsItem](docs/RedemptionRelatedRedemptionsRedemptionsItem.md) - [VoucherifySdk::RedemptionRelatedRedemptionsRollbacksItem](docs/RedemptionRelatedRedemptionsRollbacksItem.md) - [VoucherifySdk::RedemptionRewardResult](docs/RedemptionRewardResult.md) - [VoucherifySdk::RedemptionRewardResultParameters](docs/RedemptionRewardResultParameters.md) - [VoucherifySdk::RedemptionRewardResultParametersCampaign](docs/RedemptionRewardResultParametersCampaign.md) - [VoucherifySdk::RedemptionRewardResultParametersCoin](docs/RedemptionRewardResultParametersCoin.md) - [VoucherifySdk::RedemptionRewardResultParametersProduct](docs/RedemptionRewardResultParametersProduct.md) - - [VoucherifySdk::RedemptionRewardResultProduct](docs/RedemptionRewardResultProduct.md) - - [VoucherifySdk::RedemptionRewardResultSku](docs/RedemptionRewardResultSku.md) - - [VoucherifySdk::RedemptionRewardResultVoucher](docs/RedemptionRewardResultVoucher.md) - [VoucherifySdk::RedemptionRollback](docs/RedemptionRollback.md) + - [VoucherifySdk::RedemptionRollbackChannel](docs/RedemptionRollbackChannel.md) + - [VoucherifySdk::RedemptionRollbackGift](docs/RedemptionRollbackGift.md) + - [VoucherifySdk::RedemptionRollbackLoyaltyCard](docs/RedemptionRollbackLoyaltyCard.md) - [VoucherifySdk::RedemptionRollbackRelatedRedemptions](docs/RedemptionRollbackRelatedRedemptions.md) - - [VoucherifySdk::RedemptionRollbackRelatedRedemptionsItem](docs/RedemptionRollbackRelatedRedemptionsItem.md) + - [VoucherifySdk::RedemptionRollbackRelatedRedemptionsRedemptionsItem](docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md) - [VoucherifySdk::RedemptionRollbackRelatedRedemptionsRollbacksItem](docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md) + - [VoucherifySdk::RedemptionVoucher](docs/RedemptionVoucher.md) + - [VoucherifySdk::RedemptionVoucherGift](docs/RedemptionVoucherGift.md) + - [VoucherifySdk::RedemptionVoucherLoyaltyCard](docs/RedemptionVoucherLoyaltyCard.md) + - [VoucherifySdk::RedemptionVoucherPublish](docs/RedemptionVoucherPublish.md) + - [VoucherifySdk::RedemptionVoucherRedemption](docs/RedemptionVoucherRedemption.md) - [VoucherifySdk::RedemptionsGetResponseBody](docs/RedemptionsGetResponseBody.md) + - [VoucherifySdk::RedemptionsGetResponseBodyChannel](docs/RedemptionsGetResponseBodyChannel.md) + - [VoucherifySdk::RedemptionsGetResponseBodyCustomer](docs/RedemptionsGetResponseBodyCustomer.md) + - [VoucherifySdk::RedemptionsGetResponseBodyGift](docs/RedemptionsGetResponseBodyGift.md) + - [VoucherifySdk::RedemptionsGetResponseBodyLoyaltyCard](docs/RedemptionsGetResponseBodyLoyaltyCard.md) + - [VoucherifySdk::RedemptionsGetResponseBodyOrder](docs/RedemptionsGetResponseBodyOrder.md) + - [VoucherifySdk::RedemptionsGetResponseBodyOrderCustomer](docs/RedemptionsGetResponseBodyOrderCustomer.md) + - [VoucherifySdk::RedemptionsGetResponseBodyOrderReferrer](docs/RedemptionsGetResponseBodyOrderReferrer.md) + - [VoucherifySdk::RedemptionsGetResponseBodyPromotionTier](docs/RedemptionsGetResponseBodyPromotionTier.md) + - [VoucherifySdk::RedemptionsGetResponseBodyPromotionTierAction](docs/RedemptionsGetResponseBodyPromotionTierAction.md) + - [VoucherifySdk::RedemptionsGetResponseBodyPromotionTierCampaign](docs/RedemptionsGetResponseBodyPromotionTierCampaign.md) + - [VoucherifySdk::RedemptionsGetResponseBodyPromotionTierSummary](docs/RedemptionsGetResponseBodyPromotionTierSummary.md) + - [VoucherifySdk::RedemptionsGetResponseBodyPromotionTierSummaryOrders](docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md) + - [VoucherifySdk::RedemptionsGetResponseBodyPromotionTierSummaryRedemptions](docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md) + - [VoucherifySdk::RedemptionsGetResponseBodyRelatedRedemptions](docs/RedemptionsGetResponseBodyRelatedRedemptions.md) + - [VoucherifySdk::RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem](docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md) + - [VoucherifySdk::RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem](docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md) + - [VoucherifySdk::RedemptionsGetResponseBodyVoucher](docs/RedemptionsGetResponseBodyVoucher.md) + - [VoucherifySdk::RedemptionsGetResponseBodyVoucherGift](docs/RedemptionsGetResponseBodyVoucherGift.md) + - [VoucherifySdk::RedemptionsGetResponseBodyVoucherLoyaltyCard](docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md) + - [VoucherifySdk::RedemptionsGetResponseBodyVoucherPublish](docs/RedemptionsGetResponseBodyVoucherPublish.md) + - [VoucherifySdk::RedemptionsGetResponseBodyVoucherRedemption](docs/RedemptionsGetResponseBodyVoucherRedemption.md) - [VoucherifySdk::RedemptionsListResponseBody](docs/RedemptionsListResponseBody.md) - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItem](docs/RedemptionsListResponseBodyRedemptionsItem.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemChannel](docs/RedemptionsListResponseBodyRedemptionsItemChannel.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemCustomer](docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemGift](docs/RedemptionsListResponseBodyRedemptionsItemGift.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemLoyaltyCard](docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemOrder](docs/RedemptionsListResponseBodyRedemptionsItemOrder.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemOrderCustomer](docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemOrderReferrer](docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTier](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierAction](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions](docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem](docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem](docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucher](docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherGift](docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard](docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherPublish](docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md) + - [VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherRedemption](docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md) - [VoucherifySdk::RedemptionsRedeemRequestBody](docs/RedemptionsRedeemRequestBody.md) + - [VoucherifySdk::RedemptionsRedeemRequestBodyOptions](docs/RedemptionsRedeemRequestBodyOptions.md) + - [VoucherifySdk::RedemptionsRedeemRequestBodyRedeemablesItem](docs/RedemptionsRedeemRequestBodyRedeemablesItem.md) + - [VoucherifySdk::RedemptionsRedeemRequestBodyRedeemablesItemGift](docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md) + - [VoucherifySdk::RedemptionsRedeemRequestBodyRedeemablesItemReward](docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md) - [VoucherifySdk::RedemptionsRedeemResponseBody](docs/RedemptionsRedeemResponseBody.md) - [VoucherifySdk::RedemptionsRollbackCreateRequestBody](docs/RedemptionsRollbackCreateRequestBody.md) - [VoucherifySdk::RedemptionsRollbackCreateResponseBody](docs/RedemptionsRollbackCreateResponseBody.md) + - [VoucherifySdk::RedemptionsRollbackCreateResponseBodyChannel](docs/RedemptionsRollbackCreateResponseBodyChannel.md) + - [VoucherifySdk::RedemptionsRollbackCreateResponseBodyGift](docs/RedemptionsRollbackCreateResponseBodyGift.md) + - [VoucherifySdk::RedemptionsRollbackCreateResponseBodyLoyaltyCard](docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md) + - [VoucherifySdk::RedemptionsRollbackCreateResponseBodyRelatedRedemptions](docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md) + - [VoucherifySdk::RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem](docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md) + - [VoucherifySdk::RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem](docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md) - [VoucherifySdk::RedemptionsRollbacksCreateRequestBody](docs/RedemptionsRollbacksCreateRequestBody.md) - [VoucherifySdk::RedemptionsRollbacksCreateResponseBody](docs/RedemptionsRollbacksCreateResponseBody.md) - - [VoucherifySdk::ReferralCampaignVoucher](docs/ReferralCampaignVoucher.md) - [VoucherifySdk::ReferralProgram](docs/ReferralProgram.md) - [VoucherifySdk::ReferralProgramCustomEvent](docs/ReferralProgramCustomEvent.md) - [VoucherifySdk::ReferralProgramRefereeReward](docs/ReferralProgramRefereeReward.md) - [VoucherifySdk::ReferralProgramRefereeRewardRelatedObjectParent](docs/ReferralProgramRefereeRewardRelatedObjectParent.md) - [VoucherifySdk::Referrer](docs/Referrer.md) + - [VoucherifySdk::ReferrerAddress](docs/ReferrerAddress.md) - [VoucherifySdk::ReferrerId](docs/ReferrerId.md) - - [VoucherifySdk::ReferrerWithSummaryLoyaltyReferrals](docs/ReferrerWithSummaryLoyaltyReferrals.md) - [VoucherifySdk::ResourceTypes](docs/ResourceTypes.md) - [VoucherifySdk::Reward](docs/Reward.md) - [VoucherifySdk::RewardAssignment](docs/RewardAssignment.md) - - [VoucherifySdk::RewardAssignmentBase](docs/RewardAssignmentBase.md) - [VoucherifySdk::RewardAssignmentParameters](docs/RewardAssignmentParameters.md) - - [VoucherifySdk::RewardAssignmentParametersParameters](docs/RewardAssignmentParametersParameters.md) - - [VoucherifySdk::RewardAssignmentParametersParametersLoyalty](docs/RewardAssignmentParametersParametersLoyalty.md) - - [VoucherifySdk::RewardAssignmentsCreateCoinRewardRequestBody](docs/RewardAssignmentsCreateCoinRewardRequestBody.md) - - [VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody](docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody.md) - - [VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters](docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters.md) - - [VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty](docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty.md) + - [VoucherifySdk::RewardAssignmentParametersLoyalty](docs/RewardAssignmentParametersLoyalty.md) - [VoucherifySdk::RewardAttributes](docs/RewardAttributes.md) - [VoucherifySdk::RewardType](docs/RewardType.md) - [VoucherifySdk::RewardTypeCampaign](docs/RewardTypeCampaign.md) - - [VoucherifySdk::RewardTypeCampaignCampaign](docs/RewardTypeCampaignCampaign.md) - [VoucherifySdk::RewardTypeCoin](docs/RewardTypeCoin.md) - - [VoucherifySdk::RewardTypeCoinCoin](docs/RewardTypeCoinCoin.md) - - [VoucherifySdk::RewardTypeMaterial](docs/RewardTypeMaterial.md) - - [VoucherifySdk::RewardTypeMaterialProduct](docs/RewardTypeMaterialProduct.md) + - [VoucherifySdk::RewardTypeProduct](docs/RewardTypeProduct.md) - [VoucherifySdk::RewardsAssignmentsCreateRequestBody](docs/RewardsAssignmentsCreateRequestBody.md) + - [VoucherifySdk::RewardsAssignmentsCreateRequestBodyParameters](docs/RewardsAssignmentsCreateRequestBodyParameters.md) + - [VoucherifySdk::RewardsAssignmentsCreateRequestBodyParametersLoyalty](docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md) - [VoucherifySdk::RewardsAssignmentsCreateResponseBody](docs/RewardsAssignmentsCreateResponseBody.md) + - [VoucherifySdk::RewardsAssignmentsCreateResponseBodyParameters](docs/RewardsAssignmentsCreateResponseBodyParameters.md) + - [VoucherifySdk::RewardsAssignmentsCreateResponseBodyParametersLoyalty](docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md) - [VoucherifySdk::RewardsAssignmentsGetResponseBody](docs/RewardsAssignmentsGetResponseBody.md) + - [VoucherifySdk::RewardsAssignmentsGetResponseBodyParameters](docs/RewardsAssignmentsGetResponseBodyParameters.md) + - [VoucherifySdk::RewardsAssignmentsGetResponseBodyParametersLoyalty](docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md) - [VoucherifySdk::RewardsAssignmentsListResponseBody](docs/RewardsAssignmentsListResponseBody.md) - [VoucherifySdk::RewardsAssignmentsUpdateRequestBody](docs/RewardsAssignmentsUpdateRequestBody.md) - [VoucherifySdk::RewardsAssignmentsUpdateRequestBodyParameters](docs/RewardsAssignmentsUpdateRequestBodyParameters.md) - [VoucherifySdk::RewardsAssignmentsUpdateRequestBodyParametersLoyalty](docs/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md) - [VoucherifySdk::RewardsAssignmentsUpdateResponseBody](docs/RewardsAssignmentsUpdateResponseBody.md) - - [VoucherifySdk::SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion](docs/SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion.md) + - [VoucherifySdk::RewardsAssignmentsUpdateResponseBodyParameters](docs/RewardsAssignmentsUpdateResponseBodyParameters.md) + - [VoucherifySdk::RewardsAssignmentsUpdateResponseBodyParametersLoyalty](docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md) + - [VoucherifySdk::RewardsCreateRequestBody](docs/RewardsCreateRequestBody.md) + - [VoucherifySdk::RewardsCreateRequestBodyAttributes](docs/RewardsCreateRequestBodyAttributes.md) + - [VoucherifySdk::RewardsCreateRequestBodyParameters](docs/RewardsCreateRequestBodyParameters.md) + - [VoucherifySdk::RewardsCreateRequestBodyParametersCampaign](docs/RewardsCreateRequestBodyParametersCampaign.md) + - [VoucherifySdk::RewardsCreateRequestBodyParametersCoin](docs/RewardsCreateRequestBodyParametersCoin.md) + - [VoucherifySdk::RewardsCreateRequestBodyParametersProduct](docs/RewardsCreateRequestBodyParametersProduct.md) + - [VoucherifySdk::RewardsCreateResponseBody](docs/RewardsCreateResponseBody.md) + - [VoucherifySdk::RewardsCreateResponseBodyAttributes](docs/RewardsCreateResponseBodyAttributes.md) + - [VoucherifySdk::RewardsListResponseBody](docs/RewardsListResponseBody.md) + - [VoucherifySdk::RewardsUpdateRequestBody](docs/RewardsUpdateRequestBody.md) + - [VoucherifySdk::RewardsUpdateRequestBodyAttributes](docs/RewardsUpdateRequestBodyAttributes.md) + - [VoucherifySdk::RewardsUpdateRequestBodyParameters](docs/RewardsUpdateRequestBodyParameters.md) + - [VoucherifySdk::RewardsUpdateRequestBodyParametersCampaign](docs/RewardsUpdateRequestBodyParametersCampaign.md) + - [VoucherifySdk::RewardsUpdateRequestBodyParametersCoin](docs/RewardsUpdateRequestBodyParametersCoin.md) + - [VoucherifySdk::RewardsUpdateRequestBodyParametersProduct](docs/RewardsUpdateRequestBodyParametersProduct.md) + - [VoucherifySdk::RewardsUpdateResponseBody](docs/RewardsUpdateResponseBody.md) + - [VoucherifySdk::RewardsUpdateResponseBodyAttributes](docs/RewardsUpdateResponseBodyAttributes.md) + - [VoucherifySdk::SegmentsCreateRequestBody](docs/SegmentsCreateRequestBody.md) + - [VoucherifySdk::SegmentsCreateResponseBody](docs/SegmentsCreateResponseBody.md) + - [VoucherifySdk::SegmentsGetResponseBody](docs/SegmentsGetResponseBody.md) - [VoucherifySdk::Session](docs/Session.md) - - [VoucherifySdk::SimpleCampaign](docs/SimpleCampaign.md) - - [VoucherifySdk::SimpleConsent](docs/SimpleConsent.md) - [VoucherifySdk::SimpleCustomer](docs/SimpleCustomer.md) - [VoucherifySdk::SimpleCustomerRequiredObjectType](docs/SimpleCustomerRequiredObjectType.md) - - [VoucherifySdk::SimpleOrder](docs/SimpleOrder.md) - - [VoucherifySdk::SimpleOrderItem](docs/SimpleOrderItem.md) - - [VoucherifySdk::SimpleProduct](docs/SimpleProduct.md) + - [VoucherifySdk::SimpleLoyaltyCard](docs/SimpleLoyaltyCard.md) - [VoucherifySdk::SimpleProductDiscountUnit](docs/SimpleProductDiscountUnit.md) - - [VoucherifySdk::SimplePromotionTier](docs/SimplePromotionTier.md) - - [VoucherifySdk::SimplePromotionTierCampaign](docs/SimplePromotionTierCampaign.md) - - [VoucherifySdk::SimpleRedemption](docs/SimpleRedemption.md) - - [VoucherifySdk::SimpleRedemptionRewardResult](docs/SimpleRedemptionRewardResult.md) - - [VoucherifySdk::SimpleReferralTier](docs/SimpleReferralTier.md) - [VoucherifySdk::SimpleSegment](docs/SimpleSegment.md) - - [VoucherifySdk::SimpleSku](docs/SimpleSku.md) - [VoucherifySdk::SimpleSkuDiscountUnit](docs/SimpleSkuDiscountUnit.md) - [VoucherifySdk::SimpleVoucher](docs/SimpleVoucher.md) + - [VoucherifySdk::SimpleVoucherRedemption](docs/SimpleVoucherRedemption.md) - [VoucherifySdk::Sku](docs/Sku.md) - - [VoucherifySdk::SkuWithProduct](docs/SkuWithProduct.md) - [VoucherifySdk::SkusGetResponseBody](docs/SkusGetResponseBody.md) - [VoucherifySdk::SkusImportCsvCreateResponseBody](docs/SkusImportCsvCreateResponseBody.md) - - [VoucherifySdk::SkusList](docs/SkusList.md) - [VoucherifySdk::SkusListForProduct](docs/SkusListForProduct.md) - - [VoucherifySdk::StackableValidateRedeemBase](docs/StackableValidateRedeemBase.md) - - [VoucherifySdk::StackableValidateRedeemBaseRedeemablesItem](docs/StackableValidateRedeemBaseRedeemablesItem.md) - [VoucherifySdk::StackingRules](docs/StackingRules.md) - - [VoucherifySdk::ValidationEntity](docs/ValidationEntity.md) - [VoucherifySdk::ValidationRule](docs/ValidationRule.md) + - [VoucherifySdk::ValidationRuleApplicableTo](docs/ValidationRuleApplicableTo.md) - [VoucherifySdk::ValidationRuleAssignment](docs/ValidationRuleAssignment.md) - [VoucherifySdk::ValidationRuleAssignmentsList](docs/ValidationRuleAssignmentsList.md) - - [VoucherifySdk::ValidationRuleBase](docs/ValidationRuleBase.md) - - [VoucherifySdk::ValidationRuleBaseApplicableTo](docs/ValidationRuleBaseApplicableTo.md) - - [VoucherifySdk::ValidationRuleBaseError](docs/ValidationRuleBaseError.md) + - [VoucherifySdk::ValidationRuleError](docs/ValidationRuleError.md) - [VoucherifySdk::ValidationRulesAssignmentsCreateRequestBody](docs/ValidationRulesAssignmentsCreateRequestBody.md) - [VoucherifySdk::ValidationRulesAssignmentsCreateResponseBody](docs/ValidationRulesAssignmentsCreateResponseBody.md) - [VoucherifySdk::ValidationRulesAssignmentsList](docs/ValidationRulesAssignmentsList.md) - [VoucherifySdk::ValidationRulesAssignmentsListResponseBody](docs/ValidationRulesAssignmentsListResponseBody.md) - [VoucherifySdk::ValidationRulesCreateRequestBody](docs/ValidationRulesCreateRequestBody.md) + - [VoucherifySdk::ValidationRulesCreateRequestBodyApplicableTo](docs/ValidationRulesCreateRequestBodyApplicableTo.md) + - [VoucherifySdk::ValidationRulesCreateRequestBodyError](docs/ValidationRulesCreateRequestBodyError.md) - [VoucherifySdk::ValidationRulesCreateResponseBody](docs/ValidationRulesCreateResponseBody.md) + - [VoucherifySdk::ValidationRulesCreateResponseBodyApplicableTo](docs/ValidationRulesCreateResponseBodyApplicableTo.md) + - [VoucherifySdk::ValidationRulesCreateResponseBodyError](docs/ValidationRulesCreateResponseBodyError.md) - [VoucherifySdk::ValidationRulesGetResponseBody](docs/ValidationRulesGetResponseBody.md) + - [VoucherifySdk::ValidationRulesGetResponseBodyApplicableTo](docs/ValidationRulesGetResponseBodyApplicableTo.md) + - [VoucherifySdk::ValidationRulesGetResponseBodyError](docs/ValidationRulesGetResponseBodyError.md) - [VoucherifySdk::ValidationRulesListResponseBody](docs/ValidationRulesListResponseBody.md) - [VoucherifySdk::ValidationRulesUpdateRequestBody](docs/ValidationRulesUpdateRequestBody.md) + - [VoucherifySdk::ValidationRulesUpdateRequestBodyApplicableTo](docs/ValidationRulesUpdateRequestBodyApplicableTo.md) + - [VoucherifySdk::ValidationRulesUpdateRequestBodyError](docs/ValidationRulesUpdateRequestBodyError.md) - [VoucherifySdk::ValidationRulesUpdateResponseBody](docs/ValidationRulesUpdateResponseBody.md) - - [VoucherifySdk::ValidationsRedeemableApplicable](docs/ValidationsRedeemableApplicable.md) - - [VoucherifySdk::ValidationsRedeemableApplicableResult](docs/ValidationsRedeemableApplicableResult.md) + - [VoucherifySdk::ValidationRulesUpdateResponseBodyApplicableTo](docs/ValidationRulesUpdateResponseBodyApplicableTo.md) + - [VoucherifySdk::ValidationRulesUpdateResponseBodyError](docs/ValidationRulesUpdateResponseBodyError.md) - [VoucherifySdk::ValidationsRedeemableInapplicable](docs/ValidationsRedeemableInapplicable.md) - [VoucherifySdk::ValidationsRedeemableInapplicableResult](docs/ValidationsRedeemableInapplicableResult.md) + - [VoucherifySdk::ValidationsRedeemableInapplicableResultDetails](docs/ValidationsRedeemableInapplicableResultDetails.md) - [VoucherifySdk::ValidationsRedeemableSkipped](docs/ValidationsRedeemableSkipped.md) - - [VoucherifySdk::ValidationsValidateAllResponseBodyRedeemablesItem](docs/ValidationsValidateAllResponseBodyRedeemablesItem.md) + - [VoucherifySdk::ValidationsRedeemableSkippedResult](docs/ValidationsRedeemableSkippedResult.md) + - [VoucherifySdk::ValidationsRedeemableSkippedResultDetails](docs/ValidationsRedeemableSkippedResultDetails.md) - [VoucherifySdk::ValidationsValidateRequestBody](docs/ValidationsValidateRequestBody.md) + - [VoucherifySdk::ValidationsValidateRequestBodyOptions](docs/ValidationsValidateRequestBodyOptions.md) + - [VoucherifySdk::ValidationsValidateRequestBodyRedeemablesItem](docs/ValidationsValidateRequestBodyRedeemablesItem.md) + - [VoucherifySdk::ValidationsValidateRequestBodyRedeemablesItemGift](docs/ValidationsValidateRequestBodyRedeemablesItemGift.md) + - [VoucherifySdk::ValidationsValidateRequestBodyRedeemablesItemReward](docs/ValidationsValidateRequestBodyRedeemablesItemReward.md) - [VoucherifySdk::ValidationsValidateResponseBody](docs/ValidationsValidateResponseBody.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItem](docs/ValidationsValidateResponseBodyRedeemablesItem.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResult](docs/ValidationsValidateResponseBodyRedeemablesItemResult.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultDetails](docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultDiscount](docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct](docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultGift](docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md) + - [VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard](docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) + - [VoucherifySdk::ValidityHours](docs/ValidityHours.md) + - [VoucherifySdk::ValidityHoursDailyItem](docs/ValidityHoursDailyItem.md) + - [VoucherifySdk::ValidityTimeframe](docs/ValidityTimeframe.md) - [VoucherifySdk::Voucher](docs/Voucher.md) - [VoucherifySdk::VoucherAssets](docs/VoucherAssets.md) + - [VoucherifySdk::VoucherAssetsBarcode](docs/VoucherAssetsBarcode.md) + - [VoucherifySdk::VoucherAssetsQr](docs/VoucherAssetsQr.md) - [VoucherifySdk::VoucherGift](docs/VoucherGift.md) - [VoucherifySdk::VoucherLoyaltyCard](docs/VoucherLoyaltyCard.md) - [VoucherifySdk::VoucherPublish](docs/VoucherPublish.md) @@ -927,24 +1198,59 @@ Class | Method | HTTP request | Description - [VoucherifySdk::VoucherTransactionDetailsReward](docs/VoucherTransactionDetailsReward.md) - [VoucherifySdk::VoucherTransactionDetailsRollback](docs/VoucherTransactionDetailsRollback.md) - [VoucherifySdk::VoucherTransactionDetailsSegment](docs/VoucherTransactionDetailsSegment.md) - - [VoucherifySdk::VoucherTransactionsExport](docs/VoucherTransactionsExport.md) - [VoucherifySdk::VoucherTransactionsExportFilterConditions](docs/VoucherTransactionsExportFilterConditions.md) - [VoucherifySdk::VoucherTransactionsExportFilterConditionsVoucherId](docs/VoucherTransactionsExportFilterConditionsVoucherId.md) - [VoucherifySdk::VoucherTransactionsExportFilterConditionsVoucherIdConditions](docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md) - [VoucherifySdk::VoucherTransactionsExportParameters](docs/VoucherTransactionsExportParameters.md) - - [VoucherifySdk::VoucherTransactionsExportResult](docs/VoucherTransactionsExportResult.md) - [VoucherifySdk::VoucherTransactionsFilters](docs/VoucherTransactionsFilters.md) - - [VoucherifySdk::VoucherValidityTimeframe](docs/VoucherValidityTimeframe.md) + - [VoucherifySdk::VoucherWithCategories](docs/VoucherWithCategories.md) + - [VoucherifySdk::VoucherWithCategoriesGift](docs/VoucherWithCategoriesGift.md) + - [VoucherifySdk::VoucherWithCategoriesLoyaltyCard](docs/VoucherWithCategoriesLoyaltyCard.md) + - [VoucherifySdk::VoucherWithCategoriesPublish](docs/VoucherWithCategoriesPublish.md) + - [VoucherifySdk::VoucherWithCategoriesRedemption](docs/VoucherWithCategoriesRedemption.md) - [VoucherifySdk::VouchersBalanceUpdateRequestBody](docs/VouchersBalanceUpdateRequestBody.md) - [VoucherifySdk::VouchersBalanceUpdateResponseBody](docs/VouchersBalanceUpdateResponseBody.md) - [VoucherifySdk::VouchersBalanceUpdateResponseBodyRelatedObject](docs/VouchersBalanceUpdateResponseBodyRelatedObject.md) + - [VoucherifySdk::VouchersCreateResponseBody](docs/VouchersCreateResponseBody.md) + - [VoucherifySdk::VouchersCreateResponseBodyGift](docs/VouchersCreateResponseBodyGift.md) + - [VoucherifySdk::VouchersCreateResponseBodyLoyaltyCard](docs/VouchersCreateResponseBodyLoyaltyCard.md) + - [VoucherifySdk::VouchersCreateResponseBodyPublish](docs/VouchersCreateResponseBodyPublish.md) + - [VoucherifySdk::VouchersCreateResponseBodyRedemption](docs/VouchersCreateResponseBodyRedemption.md) + - [VoucherifySdk::VouchersCreateWithSpecificCodeRequestBody](docs/VouchersCreateWithSpecificCodeRequestBody.md) + - [VoucherifySdk::VouchersCreateWithSpecificCodeRequestBodyRedemption](docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md) - [VoucherifySdk::VouchersDisableResponseBody](docs/VouchersDisableResponseBody.md) + - [VoucherifySdk::VouchersDisableResponseBodyGift](docs/VouchersDisableResponseBodyGift.md) + - [VoucherifySdk::VouchersDisableResponseBodyLoyaltyCard](docs/VouchersDisableResponseBodyLoyaltyCard.md) + - [VoucherifySdk::VouchersDisableResponseBodyPublish](docs/VouchersDisableResponseBodyPublish.md) + - [VoucherifySdk::VouchersDisableResponseBodyRedemption](docs/VouchersDisableResponseBodyRedemption.md) - [VoucherifySdk::VouchersEnableResponseBody](docs/VouchersEnableResponseBody.md) + - [VoucherifySdk::VouchersEnableResponseBodyGift](docs/VouchersEnableResponseBodyGift.md) + - [VoucherifySdk::VouchersEnableResponseBodyLoyaltyCard](docs/VouchersEnableResponseBodyLoyaltyCard.md) + - [VoucherifySdk::VouchersEnableResponseBodyPublish](docs/VouchersEnableResponseBodyPublish.md) + - [VoucherifySdk::VouchersEnableResponseBodyRedemption](docs/VouchersEnableResponseBodyRedemption.md) - [VoucherifySdk::VouchersGetResponseBody](docs/VouchersGetResponseBody.md) + - [VoucherifySdk::VouchersGetResponseBodyGift](docs/VouchersGetResponseBodyGift.md) + - [VoucherifySdk::VouchersGetResponseBodyLoyaltyCard](docs/VouchersGetResponseBodyLoyaltyCard.md) + - [VoucherifySdk::VouchersGetResponseBodyPublish](docs/VouchersGetResponseBodyPublish.md) + - [VoucherifySdk::VouchersGetResponseBodyRedemption](docs/VouchersGetResponseBodyRedemption.md) + - [VoucherifySdk::VouchersImportCreateItemRequestBody](docs/VouchersImportCreateItemRequestBody.md) + - [VoucherifySdk::VouchersImportCreateItemRequestBodyRedemption](docs/VouchersImportCreateItemRequestBodyRedemption.md) + - [VoucherifySdk::VouchersImportCreateResponseBody](docs/VouchersImportCreateResponseBody.md) - [VoucherifySdk::VouchersImportCsvCreateResponseBody](docs/VouchersImportCsvCreateResponseBody.md) + - [VoucherifySdk::VouchersListResponseBody](docs/VouchersListResponseBody.md) + - [VoucherifySdk::VouchersMetadataUpdateInBulkRequestBody](docs/VouchersMetadataUpdateInBulkRequestBody.md) + - [VoucherifySdk::VouchersMetadataUpdateInBulkResponseBody](docs/VouchersMetadataUpdateInBulkResponseBody.md) - [VoucherifySdk::VouchersRedemptionGetResponseBody](docs/VouchersRedemptionGetResponseBody.md) - - [VoucherifySdk::VouchersRedemptionGetResponseBodyRedemptionEntriesItem](docs/VouchersRedemptionGetResponseBodyRedemptionEntriesItem.md) - [VoucherifySdk::VouchersTransactionsExportCreateRequestBody](docs/VouchersTransactionsExportCreateRequestBody.md) - [VoucherifySdk::VouchersTransactionsExportCreateResponseBody](docs/VouchersTransactionsExportCreateResponseBody.md) + - [VoucherifySdk::VouchersTransactionsExportCreateResponseBodyResult](docs/VouchersTransactionsExportCreateResponseBodyResult.md) - [VoucherifySdk::VouchersTransactionsListResponseBody](docs/VouchersTransactionsListResponseBody.md) + - [VoucherifySdk::VouchersUpdateInBulkItemRequestBody](docs/VouchersUpdateInBulkItemRequestBody.md) + - [VoucherifySdk::VouchersUpdateInBulkResponseBody](docs/VouchersUpdateInBulkResponseBody.md) + - [VoucherifySdk::VouchersUpdateRequestBody](docs/VouchersUpdateRequestBody.md) + - [VoucherifySdk::VouchersUpdateResponseBody](docs/VouchersUpdateResponseBody.md) + - [VoucherifySdk::VouchersUpdateResponseBodyGift](docs/VouchersUpdateResponseBodyGift.md) + - [VoucherifySdk::VouchersUpdateResponseBodyLoyaltyCard](docs/VouchersUpdateResponseBodyLoyaltyCard.md) + - [VoucherifySdk::VouchersUpdateResponseBodyPublish](docs/VouchersUpdateResponseBodyPublish.md) + - [VoucherifySdk::VouchersUpdateResponseBodyRedemption](docs/VouchersUpdateResponseBodyRedemption.md) diff --git a/__tests__/lib/campaigns.rb b/__tests__/lib/campaigns.rb index 0fbba38c..b3b053e2 100644 --- a/__tests__/lib/campaigns.rb +++ b/__tests__/lib/campaigns.rb @@ -7,7 +7,7 @@ def create_validation_rule_applicable_to(validation_rules_api_instance, product_ created_validation_rule = validation_rules_api_instance.create_validation_rules({ validation_rules_create_request_body: VoucherifySdk::ValidationRulesCreateRequestBody.new({ name: generate_random_string(), - applicable_to: VoucherifySdk::ValidationRuleBaseApplicableTo.new({ + applicable_to: VoucherifySdk::ValidationRulesCreateRequestBodyApplicableTo.new({ included: [VoucherifySdk::ApplicableTo.new({ object: "product", id: product_id @@ -50,20 +50,21 @@ def create_validation_rule_more_than(validation_rules_api_instance, product_id) def create_discount_campaign(campaigns_api_instance, validation_rule_id) begin campaign = campaigns_api_instance.create_campaign({ - campaigns_create_request_body: VoucherifySdk::CampaignsCreateDiscountCouponsCampaign.new({ + campaigns_create_request_body: VoucherifySdk::CampaignsCreateRequestBody.new({ campaign_type: "DISCOUNT_COUPONS", name: generate_random_string(), type: "AUTO_UPDATE", - voucher: VoucherifySdk::DiscountCouponsCampaignVoucher.new({ - discount: VoucherifySdk::DiscountAmount.new({ - type: "AMOUNT", + voucher: VoucherifySdk::CampaignsCreateRequestBodyVoucher.new({ + type: 'DISCOUNT_VOUCHER', + discount: VoucherifySdk::Discount.new({ + type: 'AMOUNT', amount_off: 1000 }) }), validation_rules: [validation_rule_id] }) }) - + return campaign rescue VoucherifySdk::ApiError => e return nil @@ -111,6 +112,7 @@ def create_loyalty_campaign(campaigns_api_instance) } } }) + return campaign end end @@ -124,5 +126,23 @@ def delete_campaign(campaigns_api_instance, campaign_id) end end - +def add_vouchers_to_campaign(campaigns_api_instance, campaign_id, voucher_count) + begin + vouchers = [] + + voucher_count.times do + voucher = campaigns_api_instance.add_vouchers_to_campaign( + campaign_id, + { + vouchers_count: 1 + } + ) + vouchers << voucher.code + end + + return vouchers + rescue VoucherifySdk::ApiError => e + return nil + end + end diff --git a/__tests__/lib/config.rb b/__tests__/lib/config.rb index 51a9b016..6a52a687 100644 --- a/__tests__/lib/config.rb +++ b/__tests__/lib/config.rb @@ -60,11 +60,16 @@ def self.events_api_instance return VoucherifySdk::EventsApi.new() end - def generate_random_string(length=10) - chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a - random_string = Array.new(length) { chars.sample }.join - return random_string + def self.order_api_instance + return VoucherifySdk::OrdersApi.new() end + def self.loyalties_api_instance + return VoucherifySdk::LoyaltiesApi.new() + end + + def self.vouchers_api_instance + return VoucherifySdk::VouchersApi.new() + end end diff --git a/__tests__/lib/customers.rb b/__tests__/lib/customers.rb index 2638baff..fc06df83 100644 --- a/__tests__/lib/customers.rb +++ b/__tests__/lib/customers.rb @@ -8,7 +8,7 @@ def create_customer(customers_api_instance) customers_create_request_body: VoucherifySdk::CustomersCreateRequestBody.new({ source_id: generate_random_string(), name: "John Doe", - address: VoucherifySdk::CustomerBaseAddress.new({ + address: VoucherifySdk::CustomerAddress.new({ country: "US", city: "New York", line_1: "5th Avenue", diff --git a/__tests__/lib/loyalties.rb b/__tests__/lib/loyalties.rb new file mode 100644 index 00000000..387f925a --- /dev/null +++ b/__tests__/lib/loyalties.rb @@ -0,0 +1,32 @@ +require_relative 'utils.rb' +require 'VoucherifySdk' + +def update_loyalty_card_balance(loyalties_api_instance, memberId) + begin + updated_loyalty_member_card = loyalties_api_instance.update_loyalty_card_balance(memberId, { + loyalties_members_balance_update_request_body: VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody.new({ + points: 2000 + }) + }) + + return updated_loyalty_member_card + + rescue VoucherifySdk::ApiError => e + retun nil + end +end + +def list_loyalty_card_transactions(loyalties_api_instance, memberId) + begin + transactions = loyalties_api_instance.list_loyalty_card_transactions(memberId, + { + limit: 10, + page: 1 + }) + + return transactions + + rescue VoucherifySdk::ApiError => e + return nil + end +end diff --git a/__tests__/lib/order.rb b/__tests__/lib/order.rb new file mode 100644 index 00000000..d6d165f9 --- /dev/null +++ b/__tests__/lib/order.rb @@ -0,0 +1,67 @@ +require_relative 'utils.rb' +require 'VoucherifySdk' + +def create_order(order_api_instance) + begin + created_order = order_api_instance.create_order({ + orders_create_request_body: VoucherifySdk::OrdersCreateRequestBody.new({ + amount: 10000, + status: 'CREATED', + items: [ + { + product_id: 'test_order_item1', + quantity: 1 + }, + { + product_id: 'test_order_item2', + quantity: 1 + } + ] + }) + }) + + return created_order + + rescue VoucherifySDk::ApiError => e + return nil + end +end + +def get_order(order_api_instance, orderId) + begin + order = order_api_instance.get_order(orderId) + + return order + + rescue VoucherifySdk::ApiError => e + return nil + end +end + +def update_order(order_api_instance, orderId) + updated_order = order_api_instance.update_order(orderId, { + orders_update_request_body: VoucherifySdk::OrdersUpdateRequestBody.new({ + amount: 30000, + status: 'PAID' + }) + }) + + return updated_order + + rescue VoucherifySdk::ApiError => e + return nil +end + +def list_orders(order_api_instance) + begin + orders = order_api_instance.list_orders({ + limit: 10, + page: 1 + }) + + return orders + + rescue VoucherifySdk::ApiError => e + return nil + end +end \ No newline at end of file diff --git a/__tests__/lib/stackables.rb b/__tests__/lib/stackables.rb index 2cabdebb..25148e6c 100644 --- a/__tests__/lib/stackables.rb +++ b/__tests__/lib/stackables.rb @@ -1,7 +1,7 @@ def create_request_body_redeemable(voucher_id) begin validations_validate_request_body_redeemables = [ - VoucherifySdk::RedeemVoucher.new({ + VoucherifySdk::RedemptionEntryVoucher.new({ object: "voucher", id: voucher_id }) ] @@ -10,11 +10,14 @@ def create_request_body_redeemable(voucher_id) end -def validate_stacked_discounts(validations_api_instance, voucher_id, product_id, customer, amount) +def validate_stacked_discounts(validations_api_instance, voucher_ids, product_id, customer, amount) begin + voucher_ids = [voucher_ids] unless voucher_ids.is_a?(Array) + redeemables = voucher_ids.map { |voucher_id| create_request_body_redeemable(voucher_id) }.flatten + result = validations_api_instance.validate_stacked_discounts({ validations_validate_request_body: VoucherifySdk::ValidationsValidateRequestBody.new({ - redeemables: create_request_body_redeemable(voucher_id), + redeemables: redeemables, order: { items: [{ related_object: "product", @@ -39,19 +42,22 @@ def validate_stacked_discounts(validations_api_instance, voucher_id, product_id, }) return result; rescue VoucherifySdk::ApiError => e - puts(e) return nil; end end -def redeem_stacked_discounts(redemptions_api_instance, voucher_id) +def redeem_stacked_discounts(redemptions_api_instance, voucher_ids) begin + voucher_ids = [voucher_ids] unless voucher_ids.is_a?(Array) + redeemables = voucher_ids.map { |voucher_id| create_request_body_redeemable(voucher_id) }.flatten + result = redemptions_api_instance.redeem_stacked_discounts({ redemptions_redeem_request_body: VoucherifySdk::RedemptionsRedeemRequestBody.new({ - redeemables: create_request_body_redeemable(voucher_id), + redeemables: redeemables, order: VoucherifySdk::Order.new(amount: 20000) }) }) + return result; rescue VoucherifySdk::ApiError => e return nil; diff --git a/__tests__/lib/utils.rb b/__tests__/lib/utils.rb index 3c4bc49c..7cbfb345 100644 --- a/__tests__/lib/utils.rb +++ b/__tests__/lib/utils.rb @@ -3,3 +3,7 @@ def generate_random_string(length=10) random_string = Array.new(length) { chars.sample }.join return random_string end + +def generate_random_voucher_codes(base_code, count, length=6) + (1..count).map { "#{base_code}-#{generate_random_string(length)}" } +end \ No newline at end of file diff --git a/__tests__/lib/voucherify_data.rb b/__tests__/lib/voucherify_data.rb index fa4bcc69..a1ae5bc2 100644 --- a/__tests__/lib/voucherify_data.rb +++ b/__tests__/lib/voucherify_data.rb @@ -16,6 +16,7 @@ def initialize @product_ids = [] @sku = nil @validation_rule = nil + @order = nil end def set_discount_campaign(discount_campaign) @@ -101,4 +102,12 @@ def get_validation_rule def set_loyalty_card(loyalty_card) @loyalty_card = loyalty_card end + + def set_order(order) + @order = order + end + + def get_order + @order + end end diff --git a/__tests__/spec/01_products_spec.rb b/__tests__/spec/01_products_spec.rb new file mode 100644 index 00000000..2fa6f4fa --- /dev/null +++ b/__tests__/spec/01_products_spec.rb @@ -0,0 +1,132 @@ +require_relative '../lib/products.rb' +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Products API', :order => :defined do + before(:each) do + @products_api_instance = Config.products_api_instance() + @voucherify_data = VoucherifyData.instance() + + end + + it 'creates a product with price 20000 and price 60000', :order => :first do + created_product = create_product(@products_api_instance, 20000) + + + @voucherify_data.set_product(created_product) + @voucherify_data.add_product_id(created_product.source_id) + + created_product_2 = create_product(@products_api_instance, 60000) + + snapshot_name_created_product1 = 'products/created_product' + snapshot_name_created_product2 = 'products/created_product2' + filtered_created_product1_snapshot = get_snapshot_without_uniq_keys(snapshot_name_created_product1) + filtered_created_product2_snapshot = get_snapshot_without_uniq_keys(snapshot_name_created_product2) + + @voucherify_data.add_product_id(created_product_2.source_id) + + expect(created_product).not_to be_nil + expect(created_product_2).not_to be_nil + expect(validate_deep_match(filtered_created_product1_snapshot, created_product)).to be true + expect(validate_deep_match(filtered_created_product2_snapshot, created_product_2)).to be true + end + + it 'get product previously created', :order => :second do + product = @products_api_instance.get_product(@voucherify_data.get_product().source_id) + + snapshot_name = 'products/get_previously_created_product' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(product).not_to be_nil + expect(validate_deep_match(filtered_snapshot, product)).to be true + end + + it 'update price of created product to 55000 using source_id for founding product', :order => :third do + updated_product = update_product(@products_api_instance, @voucherify_data.get_product().source_id) + + snapshot_name = 'products/updated_product_price' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(updated_product).not_to be_nil + expect(validate_deep_match(filtered_snapshot, updated_product)).to be true + end + + it 'list products', :order => :fourth do + products = @products_api_instance.list_products() + + expect(products).not_to be_nil + expect(products.products.size).to be > 0 + end + + it 'update products in bulk', :order => :fifth do + async_action = update_product_in_bulk(@products_api_instance) + expect(async_action).not_to be_nil + end + + it 'update metadata in bulk', :order => :sixth do + async_action = update_metadata_in_bulk(@products_api_instance, @voucherify_data.get_product_ids()) + + expect(async_action).not_to be_nil + end + + it 'add sku to product with price 5000', :order => :seventh do + sku = create_sku(@products_api_instance, @voucherify_data.get_product().source_id, 5000) + + snapshot_name = 'products/added_sku_to_product' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(sku).not_to be_nil + expect(sku.source_id).not_to be_nil + expect(validate_deep_match(filtered_snapshot, sku)).to be true + + @voucherify_data.set_sku(sku) + end + + it 'update sku should have price equals 2000', :order => :eighth do + sku = update_sku(@products_api_instance, @voucherify_data.get_product().source_id, @voucherify_data.get_sku().source_id, 2000) + + snapshot_name = 'products/updated_product_sku' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(sku).not_to be_nil + expect(sku.source_id).not_to be_nil + expect(validate_deep_match(filtered_snapshot, sku)).to be true + end + + it 'get sku', :order => :ninth do + sku = @products_api_instance.get_sku(@voucherify_data.get_sku().source_id) + + snapshot_name = 'products/get_product_sku' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(sku).not_to be_nil + expect(validate_deep_match(filtered_snapshot, sku)).to be true + end + + it 'list skus in product', :order => :tenth do + skus = @products_api_instance.list_skus_in_product(@voucherify_data.get_product().source_id) + + snapshot_name = 'products/list_skus' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(skus).not_to be_nil + expect(skus.skus.size).to be > 0 + expect(validate_deep_match(filtered_snapshot, skus)).to be true + end + + #REMOVE ELEMENTS + it 'remove product', :order => :eleventh do + deleted_product = delete_product(@products_api_instance, @voucherify_data.get_product().source_id) + + expect(deleted_product).to be_nil + end + + it 'remove sku', :order => :twelweth do + deleted_sku = delete_sku(@products_api_instance, @voucherify_data.get_product().source_id, @voucherify_data.get_sku().source_id) + + expect(deleted_sku).to be_nil + end +end diff --git a/__tests__/spec/02_campaigns_spec.rb b/__tests__/spec/02_campaigns_spec.rb new file mode 100644 index 00000000..4065a43e --- /dev/null +++ b/__tests__/spec/02_campaigns_spec.rb @@ -0,0 +1,133 @@ +require_relative '../lib/campaigns.rb' +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Campaigns API', :order => :defined do + before(:each) do + @campaigns_api_instance = Config.campaigns_api_instance() + @validation_rules_api_instance = Config.validation_rules_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + $created_validation_rule = nil + $created_discount_campaign = nil + $created_promotion_campaign = nil + $created_loyalty_campaign = nil + $created_validation_rule_applicable_to = nil + + it 'create a validation rule with applicable_to', :order => :first do + validation_rule = create_validation_rule_applicable_to(@validation_rules_api_instance, @voucherify_data.get_product.id) + + snapshot_name = 'campaigns/created_validation_rule_applicable_to' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(validation_rule).not_to be_nil + expect(validate_deep_match(filtered_snapshot, validation_rule)).to be true + + $created_validation_rule_applicable_to = validation_rule + @voucherify_data.set_validation_rule(validation_rule) + end + + it 'create a discount campaign with applicable_to validation rule', :order => :second do + created_discount_campaign = create_discount_campaign(@campaigns_api_instance, $created_validation_rule_applicable_to.id) + + snapshot_name = 'campaigns/created_discount_campaign' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_discount_campaign).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_discount_campaign)).to be true + + $created_discount_campaign = created_discount_campaign + @voucherify_data.set_discount_campaign(created_discount_campaign) + end + + it 'create a promotion campaign', :order => :thrid do + created_promotion_campaign = create_promotion_campaign(@campaigns_api_instance) + + snapshot_name = 'campaigns/created_promotion_campaign' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_promotion_campaign).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_promotion_campaign)).to be true + + $created_promotion_campaign = created_promotion_campaign + end + + it 'create a loyalty campaign', :order => :fourth do + created_loyalty_campaign = create_loyalty_campaign(@campaigns_api_instance) + + snapshot_name = 'campaigns/created_loyalty_campaign' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_loyalty_campaign).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_loyalty_campaign)).to be true + + $created_loyalty_campaign = created_loyalty_campaign + @voucherify_data.set_loyalty_campaign(created_loyalty_campaign) + end + + it 'delete the promotion campaign', :order => :fifth do + deleted_promotion_campaign = delete_campaign(@campaigns_api_instance, $created_promotion_campaign.id) + + expect(deleted_promotion_campaign).not_to be_nil + end + + it 'add voucher to campaign', :order => :sixth do + created_voucher = @campaigns_api_instance.add_vouchers_to_campaign($created_discount_campaign.id, { + vouchers_count: 1, + }) + + snapshot_name = 'campaigns/added_voucher_to_campaign' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + @voucherify_data.set_voucher(created_voucher) + + expect(created_voucher).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_voucher)).to be true + end + + it 'create a bundle of vouchers', :order => :seventh do + async_action = @campaigns_api_instance.add_vouchers_to_campaign($created_discount_campaign.id, { + vouchers_count: 5, + }) + + expect(async_action).not_to be_nil + end + + it 'add loyalty card to campaign', :order => :eighth do + created_loyalty_card = @campaigns_api_instance.add_vouchers_to_campaign($created_loyalty_campaign.id, { + vouchers_count: 1, + }) + + snapshot_name = 'campaigns/added_loyalty_card_to_campaign' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + @voucherify_data.set_loyalty_card(created_loyalty_card) + expect(created_loyalty_card).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_loyalty_card)).to be true + end + + it 'create a campaign with validation rule and add voucher', :order => :ninth do + validation_rule = create_validation_rule_more_than(@validation_rules_api_instance, @voucherify_data.get_product.id) + campaign = create_discount_campaign(@campaigns_api_instance, validation_rule.id) + + snapshot_name_validation_rule = 'campaigns/created_validation_rule_more_than' + snapshot_name_campaign = 'campaigns/created_discount_campaign_with_val_rule' + filtered_campaign_snapshot = get_snapshot_without_uniq_keys(snapshot_name_campaign) + filtered_validation_rule_snapshot = get_snapshot_without_uniq_keys(snapshot_name_validation_rule) + + expect(validation_rule).not_to be_nil + expect(campaign).not_to be_nil + expect(validate_deep_match(filtered_campaign_snapshot, campaign)).to be true + expect(validate_deep_match(filtered_validation_rule_snapshot, validation_rule)).to be true + + voucher = @campaigns_api_instance.add_vouchers_to_campaign(campaign.id, { + vouchers_count: 1, + }) + + @voucherify_data.set_voucher_with_more_than_validation_rule(voucher) + end +end diff --git a/__tests__/spec/03_customers_spec.rb b/__tests__/spec/03_customers_spec.rb new file mode 100644 index 00000000..623a3d8c --- /dev/null +++ b/__tests__/spec/03_customers_spec.rb @@ -0,0 +1,39 @@ +require_relative '../lib/customers.rb' +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Customers API', :order => :defined do + before(:each) do + @customers_api_instance = Config.customers_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'create a customer', :order => :first do + created_customer = create_customer(@customers_api_instance) + + snapshot_name = 'customers/created_customer' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_customer).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_customer)).to be true + @voucherify_data.set_customer(created_customer) + end + + it 'create a customer and delete it', :order => :second do + created_customer = create_customer(@customers_api_instance) + deleted_customer = delete_customer_permanently(@customers_api_instance, created_customer.id) + + snapshot_name_created_customer = 'customers/created_customer' + snapshot_name_deleted_customer = 'customers/deleted_customer' + filtered_created_customer_snapshot = get_snapshot_without_uniq_keys(snapshot_name_created_customer) + filtered_deleted_customer_snapshot = get_snapshot_without_uniq_keys(snapshot_name_deleted_customer) + + expect(created_customer).not_to be_nil + expect(created_customer).not_to be_nil + expect(validate_deep_match(filtered_created_customer_snapshot, created_customer)).to be true + expect(validate_deep_match(filtered_deleted_customer_snapshot, deleted_customer)).to be true + end +end diff --git a/__tests__/spec/04_publications_spec.rb b/__tests__/spec/04_publications_spec.rb new file mode 100644 index 00000000..652b74e2 --- /dev/null +++ b/__tests__/spec/04_publications_spec.rb @@ -0,0 +1,31 @@ +require_relative '../lib/config.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Publications API', :order => :defined do + before(:each) do + @publications_api_instance = Config.publications_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'create a publication', :order => :first do + publication = @publications_api_instance.create_publication({ + join_once: true, + publications_create_request_body: VoucherifySdk::PublicationsCreateRequestBody.new({ + customer: VoucherifySdk::Customer.new({ + id: @voucherify_data.get_customer().id + }), + campaign: VoucherifySdk::CreatePublicationCampaign.new({ + name: @voucherify_data.get_discount_campaign().name + }) + }) + }) + + snapshot_name = 'publications/created_publication' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(publication).not_to be_nil + expect(validate_deep_match(filtered_snapshot, publication)).to be true + end +end diff --git a/__tests__/spec/05_qualifications_spec.rb b/__tests__/spec/05_qualifications_spec.rb new file mode 100644 index 00000000..1607e923 --- /dev/null +++ b/__tests__/spec/05_qualifications_spec.rb @@ -0,0 +1,42 @@ +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Qualifications API', :order => :defined do + before(:each) do + @qualifications_api_instance = Config.qualifications_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'check eligibility', :order => :first do + qualifications_result = @qualifications_api_instance.check_eligibility({ + qualifications_check_eligibility_request_body: VoucherifySdk::QualificationsCheckEligibilityRequestBody.new({ + customer: VoucherifySdk::Customer.new({ + id: @voucherify_data.get_customer().id + }), + order: VoucherifySdk::Order.new({ + amount: 20000, + }), + options: VoucherifySdk::QualificationsOption.new({ + limit: 1, + filters: VoucherifySdk::QualificationsOptionFilters.new({ + resource_type: VoucherifySdk::QualificationsOptionFiltersResourceType.new({ + conditions: VoucherifySdk::QualificationsOptionFiltersResourceTypeConditions.new({ + _in: ['voucher'] + }) + }) + }) + }) + }) + }) + + + snapshot_name = 'qualifications/checked_eligibility' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(qualifications_result).not_to be_nil + expect(validate_deep_match(filtered_snapshot, qualifications_result)).to be true + end +end diff --git a/__tests__/spec/06_validations_spec.rb b/__tests__/spec/06_validations_spec.rb new file mode 100644 index 00000000..d4b602cc --- /dev/null +++ b/__tests__/spec/06_validations_spec.rb @@ -0,0 +1,140 @@ +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative '../lib/stackables.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Validations API', :order => :defined do + before(:each) do + @validations_api_instance = Config.validations_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + $validation_result_successful = nil + $order_amount_successful = 20000 + + $validation_result_failed = nil + $order_amount_failed = 1000 + + it 'validate stacked discounts (successful)', :order => :first do + $validation_result_successful = validate_stacked_discounts( + @validations_api_instance, + @voucherify_data.get_voucher().code, + @voucherify_data.get_product.id, + @voucherify_data.get_customer(), + $order_amount_successful + ) + + snapshot_name = 'validations/applicable_stacked_validation' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect($validation_result_successful).not_to be_nil + expect(validate_deep_match(filtered_snapshot, $validation_result_successful)).to be true + end + + it 'validates presence of the redeemables array (successful)', :order => :second do + expect($validation_result_successful.redeemables).not_to be_nil + expect($validation_result_successful.redeemables).to be_an(Array) + end + + it 'checks if redeemables items have necessary keys (successful)', :order => :third do + redeemable = $validation_result_successful.redeemables.first + + snapshot_name = 'validations/redeemable_items_necessary_keys' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(redeemable.status).to eq("APPLICABLE") + expect(redeemable.id).not_to be_nil + expect(redeemable.object).to eq("voucher") + expect(redeemable.order).to be_a(VoucherifySdk::OrderCalculated) + expect(redeemable.applicable_to).to be_a(VoucherifySdk::ApplicableToResultList) + expect(redeemable.inapplicable_to).to be_a(VoucherifySdk::InapplicableToResultList) + expect(redeemable.result).to be_a(VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResult) + expect(validate_deep_match(filtered_snapshot, redeemable)).to be true + end + + it 'validates the order object structure (successful)', :order => :fourth do + order = $validation_result_successful.order + + snapshot_name = 'validations/validations_succesful_order' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(order).not_to be_nil + expect(order.amount).to eq($order_amount_successful) + expect(order.total_amount).to eq($order_amount_successful - @voucherify_data.get_discount_campaign().voucher.discount.amount_off) + expect(validate_deep_match(filtered_snapshot, order)).to be true + end + + it 'validates details of the discount in the first redeemable (successful)', :order => :fifth do + discount = $validation_result_successful.redeemables.first.result.discount + + expect(discount.type).to eq("AMOUNT") + expect(discount.amount_off).to eq(@voucherify_data.get_discount_campaign().voucher.discount.amount_off) + end + + it 'checks is redeemables applicable_to points on product (successful)', :order => :sixth do + redeemable = $validation_result_successful.redeemables.first + applicable_to = redeemable.applicable_to + + expect(applicable_to.data).not_to be_nil + expect(applicable_to.data).to be_a(Array) + + applicable_to_first = applicable_to.data.first + expect(applicable_to_first).not_to be_nil + expect(applicable_to_first.object).to eq("product") + expect(applicable_to_first.id).to eq(@voucherify_data.get_product().id) + end + + it 'checks validation customer response is valid (successful)', :order => :seventh do + expect($validation_result_successful.tracking_id).to_not be_nil + expect($validation_result_successful.order.customer).to_not be_nil + expect($validation_result_successful.order.customer).to be_a(VoucherifySdk::CustomerId) + expect($validation_result_successful.order.customer.id).to eq(@voucherify_data.get_customer().id) + expect($validation_result_successful.order.customer.object).to eq("customer") + end + + it 'validate stacked discounts (failed)', :order => :eighth do + $validation_result_failed = validate_stacked_discounts( + @validations_api_instance, + @voucherify_data.get_voucher_with_more_than_validation_rule().code, + @voucherify_data.get_product.id, + @voucherify_data.get_customer(), + $order_amount_failed + ) + + snapshot_name = 'validations/inapplicable_stacked_validation' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect($validation_result_failed).not_to be_nil + expect($validation_result_failed.valid).to be(false) + expect(validate_deep_match(filtered_snapshot, $validation_result_failed)).to be true + end + + it 'validates presence of the redeemables and inapplicable_redeemables (failed)', :order => :ninth do + expect($validation_result_failed.redeemables).not_to be_nil + expect($validation_result_failed.redeemables).to be_an(Array) + + expect($validation_result_failed.inapplicable_redeemables).not_to be_nil + expect($validation_result_failed.inapplicable_redeemables).to be_an(Array) + end + + it 'checks if redeemables items have necessary keys (failed)', :order => :tenth do + inapplicable_redeemables = $validation_result_failed.inapplicable_redeemables.first + + expect(inapplicable_redeemables.status).to eq("INAPPLICABLE") + expect(inapplicable_redeemables.id).to eq(@voucherify_data.get_voucher_with_more_than_validation_rule().code) + expect(inapplicable_redeemables.object).to eq("voucher") + + expect(inapplicable_redeemables.result).not_to be_nil + expect(inapplicable_redeemables.result).to be_a(VoucherifySdk::ValidationsRedeemableInapplicableResult) + + expect(inapplicable_redeemables.result.error).not_to be_nil + expect(inapplicable_redeemables.result.error).to be_an(VoucherifySdk::Error) + end + + it 'checks validation customer response is valid (failed)', :order => :eleventh do + expect($validation_result_failed.tracking_id).to_not be_nil + end + +end diff --git a/__tests__/spec/07_vouchers_spec.rb b/__tests__/spec/07_vouchers_spec.rb new file mode 100644 index 00000000..071acb1e --- /dev/null +++ b/__tests__/spec/07_vouchers_spec.rb @@ -0,0 +1,59 @@ +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require 'VoucherifySdk' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Vouchers API', :order => :defined do + before(:each) do + @vouchers_api_instance = Config.vouchers_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'get voucher previously created', :order => :first do + voucher = @vouchers_api_instance.get_voucher(@voucherify_data.get_voucher().code) + + snapshot_name = 'vouchers/get_previously_created_voucher' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(voucher).not_to be_nil + expect(validate_deep_match(filtered_snapshot, voucher)).to be true + end + + it 'disable voucher previously created', :order => :second do + voucher = @vouchers_api_instance.disable_voucher(@voucherify_data.get_voucher().code) + + snapshot_name = 'vouchers/disabled_previously_created_voucher' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(voucher).not_to be_nil + expect(validate_deep_match(filtered_snapshot, voucher)).to be true + end + + it 'enable voucher previously created', :order => :thrird do + voucher = @vouchers_api_instance.enable_voucher(@voucherify_data.get_voucher().code) + + snapshot_name = 'vouchers/enabled_previously_created_voucher' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(voucher).not_to be_nil + expect(validate_deep_match(filtered_snapshot, voucher)).to be true + end + + it 'update loyalty card balance', :order => :fourth do + vouchers_balance_update_request_body = VoucherifySdk::VouchersBalanceUpdateRequestBody.new({ + source_id: generate_random_string(), + amount: 10000, + reason: "Regular customer" + }) + + response = @vouchers_api_instance.update_voucher_balance(@voucherify_data.get_loyalty_card().code, vouchers_balance_update_request_body) + + snapshot_name = 'vouchers/updated_loyalty_card_balance' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(response).not_to be_nil + expect(validate_deep_match(filtered_snapshot, response)).to be true + end +end diff --git a/__tests__/spec/08_events_spec.rb b/__tests__/spec/08_events_spec.rb new file mode 100644 index 00000000..9c9d7cf8 --- /dev/null +++ b/__tests__/spec/08_events_spec.rb @@ -0,0 +1,23 @@ +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative '../lib/events.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Events API', :order => :defined do + before(:each) do + @events_api_instance = Config.events_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'track custom event', :order => :first do + created_event = create_event(@events_api_instance) + + snapshot_name = 'events/created_event' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_event).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_event)).to be true + end +end diff --git a/__tests__/spec/09_redemptions_spec.rb b/__tests__/spec/09_redemptions_spec.rb new file mode 100644 index 00000000..d6731153 --- /dev/null +++ b/__tests__/spec/09_redemptions_spec.rb @@ -0,0 +1,42 @@ +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative '../lib/stackables.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Redemptions API', :order => :defined do + before(:each) do + @redemptions_api_instance = Config.redemptions_api_instance() + @voucherify_data = VoucherifyData.instance() + @campaigns_api_instance = Config.campaigns_api_instance() + end + + it 'redeem stacked discounts (applicable)', :order => :first do + result = redeem_stacked_discounts(@redemptions_api_instance, @voucherify_data.get_voucher().code) + + snapshot_name = 'redemptions/redeem_stacked_applicable_discounts' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(result).not_to be_nil + expect(result.redemptions).to be_an(Array) + expect(result.order).to be_a(VoucherifySdk::OrderCalculated) +# expect(validate_deep_match(filtered_snapshot, result)).to be true + end + + it 'redeem stacked discounts (skipped)', :order => :second do + vouchers = add_vouchers_to_campaign(@campaigns_api_instance, @voucherify_data.get_discount_campaign().id(), 30) + result = redeem_stacked_discounts(@redemptions_api_instance, vouchers) + + snapshot_name = 'redemptions/redeem_stacked_skipped_discounts' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(result).not_to be_nil + expect(result.redemptions).to be_an(Array) + expect(result.order).to be_a(VoucherifySdk::OrderCalculated) + expect(result.skipped_redeemables).to be_an(Array) +# expect(validate_deep_match(filtered_snapshot, result)).to be true + end + + +end diff --git a/__tests__/spec/10_orders_spec.rb b/__tests__/spec/10_orders_spec.rb new file mode 100644 index 00000000..9912aa1d --- /dev/null +++ b/__tests__/spec/10_orders_spec.rb @@ -0,0 +1,61 @@ +require_relative '../lib/order.rb' +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Order API', :order => :defined do + before(:each) do + @order_api_instance = Config.order_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'should create order with status "created"', :order => :first do + begin + created_order = create_order(@order_api_instance) + + snapshot_name = 'orders/created_order' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_order).not_to be_nil + expect(validate_deep_match(filtered_snapshot, created_order)).to be true + + @voucherify_data.set_order(created_order) + end + end + + it 'should get previously order with status "created"', :order => :second do + begin + order = get_order(@order_api_instance, @voucherify_data.get_order().id) + + snapshot_name = 'orders/created_order' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(order).not_to be_nil + expect(validate_deep_match(filtered_snapshot, order)).to be true + end + end + + it 'should update previously order with status "created" to "paid"', :order => :third do + begin + updated_order = update_order(@order_api_instance, @voucherify_data.get_order().id) + + snapshot_name = 'orders/updated_created_order_to_paid_status' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(updated_order).not_to be_nil + expect(validate_deep_match(filtered_snapshot, updated_order)).to be true + + @voucherify_data.set_order(updated_order) + end + end + + it 'should list first 10 orders', :order => :fourth do + begin + orders = list_orders(@order_api_instance) + + expect(orders).not_to be_nil + end + end +end diff --git a/__tests__/spec/11_loyalties_spec.rb b/__tests__/spec/11_loyalties_spec.rb new file mode 100644 index 00000000..a320a35c --- /dev/null +++ b/__tests__/spec/11_loyalties_spec.rb @@ -0,0 +1,40 @@ +require_relative '../lib/loyalties.rb' +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Loyalties API', :order => :defined do + before(:each) do + @loyalties_api_instance = Config.loyalties_api_instance() + @voucherify_data = VoucherifyData.instance() + @campaigns_api_instance = Config.campaigns_api_instance() + end + + it 'should update loyalty member balance by 1000 points', :order => :first do + begin + loyalty_card = @voucherify_data.get_loyalty_card() + updated_loyalty_member_card = update_loyalty_card_balance(@loyalties_api_instance, loyalty_card.code) + + snapshot_name = 'loyalties/updated_loyalty_member_card' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(updated_loyalty_member_card).not_to be_nil + expect(validate_deep_match(filtered_snapshot, updated_loyalty_member_card)).to be true + end + end + + it 'should return list of member loyalty tansactions', :order => :second do + begin + loyalty_card = @voucherify_data.get_loyalty_card() + transactions = list_loyalty_card_transactions(@loyalties_api_instance, loyalty_card.code) + + snapshot_name = 'loyalties/member_transactions' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(transactions).not_to be_nil + expect(validate_deep_match(filtered_snapshot, transactions)).to be true + end + end +end diff --git a/__tests__/spec/12_validation_rules_spec.rb b/__tests__/spec/12_validation_rules_spec.rb new file mode 100644 index 00000000..2b33253c --- /dev/null +++ b/__tests__/spec/12_validation_rules_spec.rb @@ -0,0 +1,39 @@ +require_relative '../lib/config.rb' +require_relative '../lib/voucherify_data.rb' +require 'VoucherifySdk' +require_relative 'support/snapshot_helper' +require_relative 'support/get_snapshot_without_uniq_keys' +require_relative 'support/validate_deep_match' + +RSpec.describe 'Validation Rules API', :order => :defined do + before(:each) do + @validation_rules_api_instance = Config.validation_rules_api_instance() + @voucherify_data = VoucherifyData.instance() + end + + it 'create validation rule', :order => :first do + voucher = @voucherify_data.get_voucher() + validation_rule = @voucherify_data.get_validation_rule() + + validationRulesAssignmentsCreateRequestBody = VoucherifySdk::ValidationRulesAssignmentsCreateRequestBody.new({ + related_object_type: "voucher", + related_object_id: voucher.code + }) + + created_validation_rule_assignment = @validation_rules_api_instance.create_validation_rule_assignment(validation_rule.id, { + validation_rules_assignments_create_request_body: validationRulesAssignmentsCreateRequestBody + }) + snapshot_name = 'validation_rules/created_validation_rule_assignment' + filtered_snapshot = get_snapshot_without_uniq_keys(snapshot_name) + + expect(created_validation_rule_assignment).not_to be_nil + expect(created_validation_rule_assignment.id).not_to be_nil + expect(created_validation_rule_assignment.created_at).not_to be_nil + expect(created_validation_rule_assignment.rule_id).to eq(validation_rule.id) + expect(created_validation_rule_assignment.related_object_id).to eq(voucher.id) + expect(created_validation_rule_assignment.related_object_type).to eq("voucher") + expect(created_validation_rule_assignment.object).to eq("validation_rules_assignment") + expect(validate_deep_match(filtered_snapshot, created_validation_rule_assignment)).to be true + end + +end diff --git a/__tests__/spec/1_products_spec.rb b/__tests__/spec/1_products_spec.rb deleted file mode 100644 index 7290ba60..00000000 --- a/__tests__/spec/1_products_spec.rb +++ /dev/null @@ -1,101 +0,0 @@ -require_relative '../lib/products.rb' -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' - -RSpec.describe 'Products API', :order => :defined do - before(:each) do - @products_api_instance = Config.products_api_instance() - @voucherify_data = VoucherifyData.instance() - - end - - it 'creates a product with price 20000 and price 60000', :order => :first do - created_product = create_product(@products_api_instance, 20000) - expect(created_product).not_to be_nil - - @voucherify_data.set_product(created_product) - @voucherify_data.add_product_id(created_product.source_id) - - created_product_2 = create_product(@products_api_instance, 60000) - expect(created_product_2).not_to be_nil - - @voucherify_data.add_product_id(created_product_2.source_id) - end - - it 'get product previously created', :order => :second do - product = @products_api_instance.get_product(@voucherify_data.get_product().source_id) - - expect(product).not_to be_nil - expect(product.price).to eq(20000) - end - - it 'update price of created product to 55000 using source_id for founding product', :order => :third do - updated_product = update_product(@products_api_instance, @voucherify_data.get_product().source_id) - - expect(updated_product).not_to be_nil - expect(updated_product.price).to eq(55000) - end - - it 'list products', :order => :fourth do - products = @products_api_instance.list_products() - - expect(products).not_to be_nil - expect(products.products.size).to be > 0 - end - - it 'update products in bulk', :order => :fifth do - async_action = update_product_in_bulk(@products_api_instance) - - expect(async_action).not_to be_nil - end - - it 'update metadata in bulk', :order => :sixth do - async_action = update_metadata_in_bulk(@products_api_instance, @voucherify_data.get_product_ids()) - - expect(async_action).not_to be_nil - end - - it 'add sku to product with price 5000', :order => :seventh do - sku = create_sku(@products_api_instance, @voucherify_data.get_product().source_id, 5000) - - expect(sku).not_to be_nil - expect(sku.source_id).not_to be_nil - expect(sku.price).to eq(5000) - - @voucherify_data.set_sku(sku) - end - - it 'update sku should have price equals 2000', :order => :eighth do - sku = update_sku(@products_api_instance, @voucherify_data.get_product().source_id, @voucherify_data.get_sku().source_id, 2000) - - expect(sku).not_to be_nil - expect(sku.source_id).not_to be_nil - expect(sku.price).to eq(2000) - end - - it 'get sku', :order => :ninth do - sku = @products_api_instance.get_sku(@voucherify_data.get_sku().source_id) - - expect(sku).not_to be_nil - end - - it 'list skus in product', :order => :tenth do - skus = @products_api_instance.list_skus_in_product(@voucherify_data.get_product().source_id) - - expect(skus).not_to be_nil - expect(skus.skus.size).to be > 0 - end - - #REMOVE ELEMENTS - it 'remove product', :order => :eleventh do - deleted_product = delete_product(@products_api_instance, @voucherify_data.get_product().source_id) - - expect(deleted_product).to be_nil - end - - it 'remove sku', :order => :twelweth do - deleted_sku = delete_sku(@products_api_instance, @voucherify_data.get_product().source_id, @voucherify_data.get_sku().source_id) - - expect(deleted_sku).to be_nil - end -end diff --git a/__tests__/spec/2_campaigns_spec.rb b/__tests__/spec/2_campaigns_spec.rb deleted file mode 100644 index 9658622d..00000000 --- a/__tests__/spec/2_campaigns_spec.rb +++ /dev/null @@ -1,95 +0,0 @@ -require_relative '../lib/campaigns.rb' -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' - -RSpec.describe 'Campaigns API', :order => :defined do - before(:each) do - @campaigns_api_instance = Config.campaigns_api_instance() - @validation_rules_api_instance = Config.validation_rules_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - $created_validation_rule = nil - $created_discount_campaign = nil - $created_promotion_campaign = nil - $created_loyalty_campaign = nil - $created_validation_rule_applicable_to = nil - - it 'create a validation rule with applicable_to', :order => :first do - validation_rule = create_validation_rule_applicable_to(@validation_rules_api_instance, @voucherify_data.get_product.id) - - expect(validation_rule).not_to be_nil - - $created_validation_rule_applicable_to = validation_rule - @voucherify_data.set_validation_rule(validation_rule) - end - - it 'create a discount campaign with applicable_to validation rule', :order => :second do - created_discount_campaign = create_discount_campaign(@campaigns_api_instance, $created_validation_rule_applicable_to.id) - - expect(created_discount_campaign).not_to be_nil - - $created_discount_campaign = created_discount_campaign - @voucherify_data.set_discount_campaign(created_discount_campaign) - end - - it 'create a promotion campaign', :order => :thrid do - created_promotion_campaign = create_promotion_campaign(@campaigns_api_instance) - - expect(created_promotion_campaign).not_to be_nil - - $created_promotion_campaign = created_promotion_campaign - end - - it 'create a loyalty campaign', :order => :fourth do - created_loyalty_campaign = create_loyalty_campaign(@campaigns_api_instance) - - expect(created_loyalty_campaign).not_to be_nil - - $created_loyalty_campaign = created_loyalty_campaign - @voucherify_data.set_loyalty_campaign(created_loyalty_campaign) - end - - it 'delete the promotion campaign', :order => :fifth do - deleted_promotion_campaign = delete_campaign(@campaigns_api_instance, $created_promotion_campaign.id) - - expect(deleted_promotion_campaign).not_to be_nil - end - - it 'create a voucher', :order => :sixth do - created_voucher = @campaigns_api_instance.add_vouchers_to_campaign($created_discount_campaign.id, { - vouchers_count: 1, - }) - @voucherify_data.set_voucher(created_voucher) - expect(created_voucher).not_to be_nil - end - - it 'create a bundle of vouchers', :order => :seventh do - async_action = @campaigns_api_instance.add_vouchers_to_campaign($created_discount_campaign.id, { - vouchers_count: 5, - }) - expect(async_action).not_to be_nil - end - - it 'create a loyalty card', :order => :eighth do - created_loyalty_card = @campaigns_api_instance.add_vouchers_to_campaign($created_loyalty_campaign.id, { - vouchers_count: 1, - }) - @voucherify_data.set_loyalty_card(created_loyalty_card) - expect(created_loyalty_card).not_to be_nil - end - - it 'create a campaign with validation rule and add voucher', :order => :ninth do - validation_rule = create_validation_rule_more_than(@validation_rules_api_instance, @voucherify_data.get_product.id) - expect(validation_rule).not_to be_nil - - campaign = create_discount_campaign(@campaigns_api_instance, validation_rule.id) - expect(campaign).not_to be_nil - - voucher = @campaigns_api_instance.add_vouchers_to_campaign(campaign.id, { - vouchers_count: 1, - }) - - @voucherify_data.set_voucher_with_more_than_validation_rule(voucher) - end -end diff --git a/__tests__/spec/3_customers_spec.rb b/__tests__/spec/3_customers_spec.rb deleted file mode 100644 index 73d972ed..00000000 --- a/__tests__/spec/3_customers_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require_relative '../lib/customers.rb' -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' - -RSpec.describe 'Customers API', :order => :defined do - before(:each) do - @customers_api_instance = Config.customers_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - it 'create a customer', :order => :first do - created_customer = create_customer(@customers_api_instance) - expect(created_customer).not_to be_nil - @voucherify_data.set_customer(created_customer) - end - - it 'create a customer and delete it', :order => :second do - created_customer = create_customer(@customers_api_instance) - expect(created_customer).not_to be_nil - - result = delete_customer_permanently(@customers_api_instance, created_customer.id) - expect(created_customer).not_to be_nil - end -end diff --git a/__tests__/spec/4_publications_spec.rb b/__tests__/spec/4_publications_spec.rb deleted file mode 100644 index 89ea6ca1..00000000 --- a/__tests__/spec/4_publications_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require_relative '../lib/config.rb' - -RSpec.describe 'Publications API', :order => :defined do - before(:each) do - @publications_api_instance = Config.publications_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - it 'create a publication', :order => :first do - publication = @publications_api_instance.create_publication({ - join_once: true, - publications_create_request_body: VoucherifySdk::CreatePublicationWithCampaign.new({ - customer: VoucherifySdk::Customer.new({ - id: @voucherify_data.get_customer().id - }), - campaign: VoucherifySdk::CreatePublicationCampaign.new({ - name: @voucherify_data.get_discount_campaign().name - }) - }) - }) - expect(publication).not_to be_nil - end -end diff --git a/__tests__/spec/5_qualifications_spec.rb b/__tests__/spec/5_qualifications_spec.rb deleted file mode 100644 index 64846cc6..00000000 --- a/__tests__/spec/5_qualifications_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' - -RSpec.describe 'Qualifications API', :order => :defined do - before(:each) do - @qualifications_api_instance = Config.qualifications_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - it 'check eligibility', :order => :first do - result = @qualifications_api_instance.check_eligibility({ - qualifications_check_eligibility_request_body: VoucherifySdk::QualificationsCheckEligibilityRequestBody.new({ - customer: VoucherifySdk::Customer.new({ - id: @voucherify_data.get_customer().id - }), - order: VoucherifySdk::Order.new({ - amount: 20000, - }), - options: VoucherifySdk::QualificationsOption.new({ - limit: 100 - }) - }) - }) - - expect(result).not_to be_nil - end -end \ No newline at end of file diff --git a/__tests__/spec/6_validations_spec.rb b/__tests__/spec/6_validations_spec.rb deleted file mode 100644 index c51d9f07..00000000 --- a/__tests__/spec/6_validations_spec.rb +++ /dev/null @@ -1,126 +0,0 @@ -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' -require_relative '../lib/stackables.rb' - -RSpec.describe 'Validations API', :order => :defined do - before(:each) do - @validations_api_instance = Config.validations_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - $validation_result_successful = nil - $order_amount_successful = 20000 - - $validation_result_failed = nil - $order_amount_failed = 1000 - - it 'validate stacked discounts (successful)', :order => :first do - $validation_result_successful = validate_stacked_discounts( - @validations_api_instance, - @voucherify_data.get_voucher().code, - @voucherify_data.get_product.id, - @voucherify_data.get_customer(), - $order_amount_successful - ) - - expect($validation_result_successful).not_to be_nil - expect($validation_result_successful.valid).to be(true) - end - - it 'validates presence of the redeemables array (successful)', :order => :second do - expect($validation_result_successful.redeemables).not_to be_nil - expect($validation_result_successful.redeemables).to be_an(Array) - end - - it 'checks if redeemables items have necessary keys (successful)', :order => :third do - redeemable = $validation_result_successful.redeemables.first - - expect(redeemable.status).to eq("APPLICABLE") - expect(redeemable.id).not_to be_nil - expect(redeemable.object).to eq("voucher") - expect(redeemable.order).to be_a(VoucherifySdk::OrderCalculated) - expect(redeemable.applicable_to).to be_a(VoucherifySdk::ApplicableToResultList) - expect(redeemable.inapplicable_to).to be_a(VoucherifySdk::InapplicableToResultList) - expect(redeemable.result).to be_a(VoucherifySdk::RedeemableResultPromotionTier) - end - - it 'validates the order object structure (successful)', :order => :fourth do - order = $validation_result_successful.order - - expect(order).not_to be_nil - expect(order.amount).to eq($order_amount_successful) - expect(order.total_amount).to eq($order_amount_successful - @voucherify_data.get_discount_campaign().voucher.discount.amount_off) - end - - it 'validates details of the discount in the first redeemable (successful)', :order => :fifth do - discount = $validation_result_successful.redeemables.first.result.discount - - expect(discount.type).to eq("AMOUNT") - expect(discount.amount_off).to eq(@voucherify_data.get_discount_campaign().voucher.discount.amount_off) - end - - it 'checks is redeemables applicable_to points on product (successful)', :order => :sixth do - redeemable = $validation_result_successful.redeemables.first - applicable_to = redeemable.applicable_to - - expect(applicable_to.data).not_to be_nil - expect(applicable_to.data).to be_a(Array) - - applicable_to_first = applicable_to.data.first - expect(applicable_to_first).not_to be_nil - expect(applicable_to_first.object).to eq("product") - expect(applicable_to_first.id).to eq(@voucherify_data.get_product().id) - end - - it 'checks validation customer response is valid (successful)', :order => :seventh do - expect($validation_result_successful.tracking_id).to_not be_nil - expect($validation_result_successful.order.customer).to_not be_nil - expect($validation_result_successful.order.customer).to be_a(VoucherifySdk::CustomerId) - expect($validation_result_successful.order.customer.id).to eq(@voucherify_data.get_customer().id) - expect($validation_result_successful.order.customer.object).to eq("customer") - end - - ######### - ######### - ######### - - it 'validate stacked discounts (failed)', :order => :eighth do - $validation_result_failed = validate_stacked_discounts( - @validations_api_instance, - @voucherify_data.get_voucher_with_more_than_validation_rule().code, - @voucherify_data.get_product.id, - @voucherify_data.get_customer(), - $order_amount_failed - ) - - expect($validation_result_failed).not_to be_nil - expect($validation_result_failed.valid).to be(false) - end - - it 'validates presence of the redeemables and inapplicable_redeemables (failed)', :order => :ninth do - expect($validation_result_failed.redeemables).not_to be_nil - expect($validation_result_failed.redeemables).to be_an(Array) - - expect($validation_result_failed.inapplicable_redeemables).not_to be_nil - expect($validation_result_failed.inapplicable_redeemables).to be_an(Array) - end - - it 'checks if redeemables items have necessary keys (failed)', :order => :tenth do - inapplicable_redeemables = $validation_result_failed.inapplicable_redeemables.first - - expect(inapplicable_redeemables.status).to eq("INAPPLICABLE") - expect(inapplicable_redeemables.id).to eq(@voucherify_data.get_voucher_with_more_than_validation_rule().code) - expect(inapplicable_redeemables.object).to eq("voucher") - - expect(inapplicable_redeemables.result).not_to be_nil - expect(inapplicable_redeemables.result).to be_a(VoucherifySdk::ValidationsRedeemableInapplicableResult) - - expect(inapplicable_redeemables.result.error).not_to be_nil - expect(inapplicable_redeemables.result.error).to be_an(VoucherifySdk::Error) - end - - it 'checks validation customer response is valid (failed)', :order => :eleventh do - expect($validation_result_failed.tracking_id).to_not be_nil - end - -end diff --git a/__tests__/spec/7_vouchers_spec.rb b/__tests__/spec/7_vouchers_spec.rb deleted file mode 100644 index ee72c04d..00000000 --- a/__tests__/spec/7_vouchers_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' -require 'VoucherifySdk' - -RSpec.describe 'Campaigns API', :order => :defined do - before(:each) do - @vouchers_api_instance = Config.vouchers_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - it 'get voucher previously created', :order => :first do - voucher = @vouchers_api_instance.get_voucher(@voucherify_data.get_voucher().code) - - expect(voucher).not_to be_nil - end - - it 'disable voucher previously created', :order => :second do - voucher = @vouchers_api_instance.disable_voucher(@voucherify_data.get_voucher().code) - - expect(voucher).not_to be_nil - end - - it 'enable voucher previously created', :order => :thrird do - voucher = @vouchers_api_instance.enable_voucher(@voucherify_data.get_voucher().code) - - expect(voucher).not_to be_nil - end - - it 'update loyalty card balance', :order => :fourth do - vouchers_balance_update_request_body = VoucherifySdk::VouchersBalanceUpdateRequestBody.new({ - source_id: generate_random_string(), - amount: 10000, - reason: "Regular customer" - }) - - response = @vouchers_api_instance.update_voucher_balance(@voucherify_data.get_loyalty_card().code, vouchers_balance_update_request_body) - - expect(response).not_to be_nil - end -end \ No newline at end of file diff --git a/__tests__/spec/8_events_spec.rb b/__tests__/spec/8_events_spec.rb deleted file mode 100644 index dfdb735d..00000000 --- a/__tests__/spec/8_events_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' -require_relative '../lib/events.rb' - -RSpec.describe 'Campaigns API', :order => :defined do - before(:each) do - @events_api_instance = Config.events_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - it 'track custom event', :order => :first do - created_event = create_event(@events_api_instance) - - expect(created_event).not_to be_nil - end -end \ No newline at end of file diff --git a/__tests__/spec/9_redemptions_spec.rb b/__tests__/spec/9_redemptions_spec.rb deleted file mode 100644 index 5fd8fed6..00000000 --- a/__tests__/spec/9_redemptions_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' -require_relative '../lib/stackables.rb' - -RSpec.describe 'Redemptions API', :order => :defined do - before(:each) do - @redemptions_api_instance = Config.redemptions_api_instance() - @voucherify_data = VoucherifyData.instance() - end - it 'redeem stacked discounts', :order => :second do - result = redeem_stacked_discounts(@redemptions_api_instance, @voucherify_data.get_voucher().code) - expect(result).not_to be_nil - end -end \ No newline at end of file diff --git a/__tests__/spec/a1_validation_rules_spec.rb b/__tests__/spec/a1_validation_rules_spec.rb deleted file mode 100644 index 6f2f972c..00000000 --- a/__tests__/spec/a1_validation_rules_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require_relative '../lib/config.rb' -require_relative '../lib/voucherify_data.rb' -require 'VoucherifySdk' - -RSpec.describe 'Validation Rules API', :order => :defined do - before(:each) do - @validation_rules_api_instance = Config.validation_rules_api_instance() - @voucherify_data = VoucherifyData.instance() - end - - it 'create validation rule', :order => :first do - voucher = @voucherify_data.get_voucher() - validation_rule = @voucherify_data.get_validation_rule() - - validationRulesAssignmentsCreateRequestBody = VoucherifySdk::ValidationRulesAssignmentsCreateRequestBody.new({ - related_object_type: "voucher", - related_object_id: voucher.code - }) - - created_validation_rule_assignment = @validation_rules_api_instance.create_validation_rule_assignment(validation_rule.id, { - validation_rules_assignments_create_request_body: validationRulesAssignmentsCreateRequestBody - }) - - expect(created_validation_rule_assignment).not_to be_nil - expect(created_validation_rule_assignment.id).not_to be_nil - expect(created_validation_rule_assignment.created_at).not_to be_nil - expect(created_validation_rule_assignment.rule_id).to eq(validation_rule.id) - expect(created_validation_rule_assignment.related_object_id).to eq(voucher.id) - expect(created_validation_rule_assignment.related_object_type).to eq("voucher") - expect(created_validation_rule_assignment.object).to eq("validation_rules_assignment") - end - -end diff --git a/__tests__/spec/snapshots/campaigns/added_loyalty_card_to_campaign.snap b/__tests__/spec/snapshots/campaigns/added_loyalty_card_to_campaign.snap new file mode 100644 index 00000000..8d069728 --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/added_loyalty_card_to_campaign.snap @@ -0,0 +1 @@ +{:id=>"v_m3PBv78p3LTnNxq5n8v3BMRv0yLTd3pF", :code=>"kQigsE1C", :campaign_id=>"camp_rd6S7Qo07powts7IM4CKx1ai", :category=>nil, :category_id=>nil, :categories=>[], :type=>"LOYALTY_CARD", :gift=>nil, :loyalty_card=>{:points=>1000, :balance=>1000}, :start_date=>nil, :expiration_date=>nil, :active=>true, :additional_info=>nil, :metadata=>{}, :assets=>{:qr=>{:id=>"108fbfa2-7fe3-4d80-97db-342401c97393", :url=>"https://dl.voucherify.io/api/v1/assets/qr/108fbfa2-7fe3-4d80-97db-342401c97393"}, :barcode=>{:id=>"346f7bef-5c0c-4a93-ad18-2496656c909e", :url=>"https://dl.voucherify.io/api/v1/assets/barcode/346f7bef-5c0c-4a93-ad18-2496656c909e"}}, :is_referral_code=>false, :created_at=>2024-07-23 10:56:50.03 UTC, :updated_at=>nil, :object=>"voucher", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[], :total=>0}, :publish=>{:object=>"list", :count=>0, :url=>"/v1/vouchers/kQigsE1C/publications?page=1&limit=10"}, :redemption=>{:quantity=>nil, :redeemed_quantity=>0, :redeemed_points=>0, :object=>"list", :url=>"/v1/vouchers/kQigsE1C/redemptions?page=1&limit=10"}} diff --git a/__tests__/spec/snapshots/campaigns/added_voucher_to_campaign.snap b/__tests__/spec/snapshots/campaigns/added_voucher_to_campaign.snap new file mode 100644 index 00000000..89fedb2e --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/added_voucher_to_campaign.snap @@ -0,0 +1 @@ +{:id=>"v_2ADOeinuR0l2GCHdlURDvJpyW5Jv7nZQ", :code=>"0HeEGdjS", :campaign_id=>"camp_ZU5NZQ9ZWzx7JiLQsDQoN2Sg", :category=>nil, :category_id=>nil, :categories=>[], :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :gift=>nil, :loyalty_card=>nil, :start_date=>nil, :expiration_date=>nil, :active=>true, :additional_info=>nil, :metadata=>{}, :assets=>{:qr=>{:id=>"5d802065-1dbe-41e7-b43d-0d52215e4587"}, :barcode=>{:id=>"b4836915-970c-43b5-bca0-3eba298b27d6", :url=>"https://dl.voucherify.io/api/v1/assets/barcode/b4836915-970c-43b5-bca0-3eba298b27d6"}}, :is_referral_code=>false, :created_at=>2024-07-23 09:23:39.436 UTC, :updated_at=>nil, :object=>"voucher", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"asgm_9wLBC1VwcFE9Qz1u", :rule_id=>"val_xGjBfc7Hp9el", :related_object_id=>"camp_ZU5NZQ9ZWzx7JiLQsDQoN2Sg", :related_object_type=>"campaign", :created_at=>2024-07-23 09:23:39.05 UTC, :object=>"validation_rules_assignment"}], :total=>1}, :publish=>{:object=>"list", :count=>0, :url=>"/v1/vouchers/0HeEGdjS/publications?page=1&limit=10"}, :redemption=>{:quantity=>nil, :redeemed_quantity=>0, :object=>"list", :url=>"/v1/vouchers/0HeEGdjS/redemptions?page=1&limit=10"}} diff --git a/__tests__/spec/snapshots/campaigns/created_discount_campaign.snap b/__tests__/spec/snapshots/campaigns/created_discount_campaign.snap new file mode 100644 index 00000000..81f30731 --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/created_discount_campaign.snap @@ -0,0 +1 @@ +{:id=>"camp_ZU5NZQ9ZWzx7JiLQsDQoN2Sg", :name=>"7VvrbNgCQz", :campaign_type=>"DISCOUNT_COUPONS", :type=>"AUTO_UPDATE", :voucher=>{:type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :redemption=>{:quantity=>nil}, :code_config=>{:length=>8.0, :charset=>"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", :pattern=>"########"}, :is_referral_code=>false}, :auto_join=>false, :join_once=>false, :use_voucher_metadata_schema=>true, :vouchers_count=>0, :active=>true, :created_at=>2024-07-23 09:23:38.966 UTC, :creation_status=>"DONE", :vouchers_generation_status=>"DONE", :protected=>false, :category_id=>nil, :categories=>[], :object=>"campaign", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"asgm_9wLBC1VwcFE9Qz1u", :rule_id=>"val_xGjBfc7Hp9el", :related_object_id=>"camp_ZU5NZQ9ZWzx7JiLQsDQoN2Sg", :related_object_type=>"campaign", :created_at=>2024-07-23 09:23:39.05 UTC, :object=>"validation_rules_assignment"}], :total=>1}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/campaigns/created_discount_campaign_with_val_rule.snap b/__tests__/spec/snapshots/campaigns/created_discount_campaign_with_val_rule.snap new file mode 100644 index 00000000..5f546f3e --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/created_discount_campaign_with_val_rule.snap @@ -0,0 +1 @@ +{:id=>"camp_lEoP0MhYX1IjzWIZ5pSiKJIZ", :name=>"ydt4xpPQrw", :campaign_type=>"DISCOUNT_COUPONS", :type=>"AUTO_UPDATE", :voucher=>{:type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :redemption=>{:quantity=>nil}, :code_config=>{:length=>8.0, :charset=>"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", :pattern=>"########"}, :is_referral_code=>false}, :auto_join=>false, :join_once=>false, :use_voucher_metadata_schema=>true, :vouchers_count=>0, :active=>true, :created_at=>2024-07-23 11:51:19.79 UTC, :creation_status=>"DONE", :vouchers_generation_status=>"DONE", :protected=>false, :category_id=>nil, :categories=>[], :object=>"campaign", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"asgm_9nOpVkzOQRiN9WZO", :rule_id=>"val_G60ksRivTwFl", :related_object_id=>"camp_lEoP0MhYX1IjzWIZ5pSiKJIZ", :related_object_type=>"campaign", :created_at=>2024-07-23 11:51:19.797 UTC, :object=>"validation_rules_assignment"}], :total=>1}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/campaigns/created_loyalty_campaign.snap b/__tests__/spec/snapshots/campaigns/created_loyalty_campaign.snap new file mode 100644 index 00000000..ec0bf366 --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/created_loyalty_campaign.snap @@ -0,0 +1 @@ +{:id=>"camp_LVvO49Vd99HeazTuUA3CZOFW", :name=>"bKof5vZlVp", :campaign_type=>"LOYALTY_PROGRAM", :type=>"STATIC", :voucher=>{:type=>"LOYALTY_CARD", :loyalty_card=>{:points=>1000}, :redemption=>{:quantity=>nil}, :code_config=>{:length=>8.0, :charset=>"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", :pattern=>"########"}, :is_referral_code=>false}, :auto_join=>false, :join_once=>false, :use_voucher_metadata_schema=>true, :vouchers_count=>0, :active=>true, :created_at=>2024-07-23 09:23:39.226 UTC, :creation_status=>"DONE", :vouchers_generation_status=>"DONE", :protected=>false, :category_id=>nil, :categories=>[], :object=>"campaign", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[], :total=>0}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/campaigns/created_promotion_campaign.snap b/__tests__/spec/snapshots/campaigns/created_promotion_campaign.snap new file mode 100644 index 00000000..249e3d3e --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/created_promotion_campaign.snap @@ -0,0 +1 @@ +{:id=>"camp_9n0mF3VAcpG0Wc3HpfC9x8FE", :name=>"jHZp79U4ni", :campaign_type=>"PROMOTION", :type=>"STATIC", :auto_join=>false, :join_once=>false, :use_voucher_metadata_schema=>false, :active=>true, :created_at=>2024-07-23 09:23:39.132 UTC, :creation_status=>"DONE", :vouchers_generation_status=>"DONE", :protected=>false, :category_id=>nil, :categories=>[], :object=>"campaign", :promotion=>{:object=>"list", :data_ref=>"tiers", :tiers=>[{:id=>"promo_dHQO0tUkTwFl1oBnhjlzWiew", :created_at=>2024-07-23 09:23:39.137 UTC, :name=>"wfEuoTvJj6", :banner=>"pjMkrc25bA", :action=>{:discount=>{:type=>"AMOUNT", :amount_off=>1000.0}}, :metadata=>{}, :hierarchy=>1, :promotion_id=>"camp_9n0mF3VAcpG0Wc3HpfC9x8FE", :campaign=>{:id=>"camp_9n0mF3VAcpG0Wc3HpfC9x8FE", :start_date=>nil, :expiration_date=>nil, :active=>true, :object=>"campaign"}, :campaign_id=>"camp_9n0mF3VAcpG0Wc3HpfC9x8FE", :active=>true, :summary=>{:redemptions=>{:total_redeemed=>0}, :orders=>{:total_amount=>0, :total_discount_amount=>0}}, :object=>"promotion_tier", :category_id=>nil, :categories=>[]}], :total=>1, :has_more=>false}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/campaigns/created_validation_rule_applicable_to.snap b/__tests__/spec/snapshots/campaigns/created_validation_rule_applicable_to.snap new file mode 100644 index 00000000..32d63fbd --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/created_validation_rule_applicable_to.snap @@ -0,0 +1 @@ +{:name=>"4XrEHjbW57", :rules=>{}, :applicable_to=>{:included=>[{:object=>"product", :id=>"prod_0f1975b6e5461bd5ea", :strict=>false, :effect=>"APPLY_TO_EVERY"}], :included_all=>false}, :type=>"basic", :context_type=>"global", :id=>"val_xGjBfc7Hp9el", :created_at=>2024-07-23 09:23:38.887 UTC, :object=>"validation_rules"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/campaigns/created_validation_rule_more_than.snap b/__tests__/spec/snapshots/campaigns/created_validation_rule_more_than.snap new file mode 100644 index 00000000..d68c8b86 --- /dev/null +++ b/__tests__/spec/snapshots/campaigns/created_validation_rule_more_than.snap @@ -0,0 +1 @@ +{:name=>"MkEByYoDCk", :rules=>{:"1"=>{:name=>"order.amount", :conditions=>{:$more_than=>[500000]}, :rules=>{}}, :logic=>"1"}, :applicable_to=>nil, :type=>"basic", :context_type=>"global", :id=>"val_4rLTA7TWP5qv", :created_at=>2024-07-23 10:56:50.122 UTC, :object=>"validation_rules"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/customers/created_customer.snap b/__tests__/spec/snapshots/customers/created_customer.snap new file mode 100644 index 00000000..1c9e6832 --- /dev/null +++ b/__tests__/spec/snapshots/customers/created_customer.snap @@ -0,0 +1 @@ +{:id=>"cust_a7zY7lhsY24jSQIqwKLl3ppX", :source_id=>"4hIlR2PkTx", :summary=>{:redemptions=>{:total_redeemed=>0, :total_failed=>0, :total_succeeded=>0, :total_rolled_back=>0, :total_rollback_failed=>0, :total_rollback_succeeded=>0, :gift=>{:redeemed_amount=>0, :amount_to_go=>0}, :loyalty_card=>{:redeemed_points=>0, :points_to_go=>0}}, :orders=>{:total_amount=>0, :total_count=>0, :average_amount=>0, :last_order_amount=>0}}, :loyalty=>{:points=>0, :referred_customers=>0, :campaigns=>{}}, :referrals=>{:total=>0, :campaigns=>[]}, :system_metadata=>{}, :created_at=>2024-07-23 12:27:32.926 UTC, :object=>"customer", :name=>"John Doe", :address=>{:city=>"New York", :line_1=>"5th Avenue", :line_2=>"1/2", :country=>"US", :postal_code=>"11-111"}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/customers/deleted_customer.snap b/__tests__/spec/snapshots/customers/deleted_customer.snap new file mode 100644 index 00000000..53e4a773 --- /dev/null +++ b/__tests__/spec/snapshots/customers/deleted_customer.snap @@ -0,0 +1 @@ +{:id=>"del_SOZhIE2k4Zh7gF5VB81eBZAX", :created_at=>2024-07-23 12:27:33.288 UTC, :related_object_id=>"cust_Rk2bn6dkXRF56hALcd5SGzIA", :related_object=>"customer", :status=>"DONE", :data_json=>{:events=>0, :daily_events=>0, :segments=>0, :orders=>1, :customer=>1}, :object=>"pernament_deletion"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/events/created_event.snap b/__tests__/spec/snapshots/events/created_event.snap new file mode 100644 index 00000000..307f9ed3 --- /dev/null +++ b/__tests__/spec/snapshots/events/created_event.snap @@ -0,0 +1 @@ +{:object=>"event", :type=>"test-event", :customer=>{:id=>"cust_t10PA85aLTW0t5iWX6jayAkI", :source_id=>"test-customer", :name=>nil, :email=>nil, :object=>"customer"}, :referral=>nil, :loyalty=>nil} \ No newline at end of file diff --git a/__tests__/spec/snapshots/loyalties/member_transactions.snap b/__tests__/spec/snapshots/loyalties/member_transactions.snap new file mode 100644 index 00000000..e58d6a42 --- /dev/null +++ b/__tests__/spec/snapshots/loyalties/member_transactions.snap @@ -0,0 +1 @@ +{:object=>"list", :data_ref=>"data", :data=>[{:id=>"vtx_0f1aa1f3d8480580b2", :source_id=>nil, :voucher_id=>"v_2P1uNm5WiyAmO1S5Fd1AnLmoYTs4ZEln", :campaign_id=>"camp_glFExoLTVEVCFcoE337R4d7z", :source=>nil, :reason=>nil, :type=>"POINTS_ADDITION", :details=>{:balance=>{:type=>"loyalty_card", :total=>13000, :object=>"balance", :points=>2000, :balance=>13000, :related_object=>{:id=>"v_2P1uNm5WiyAmO1S5Fd1AnLmoYTs4ZEln", :type=>"voucher"}}}, :related_transaction_id=>nil, :created_at=>2024-07-24 07:15:23.099 UTC}, {:id=>"vtx_0f1aa1eb49956be596", :source_id=>"CfneTLId3K", :voucher_id=>"v_2P1uNm5WiyAmO1S5Fd1AnLmoYTs4ZEln", :campaign_id=>"camp_glFExoLTVEVCFcoE337R4d7z", :source=>"API", :reason=>"Regular customer", :type=>"POINTS_ADDITION", :details=>{:balance=>{:type=>"loyalty_card", :total=>11000, :object=>"balance", :points=>10000, :balance=>11000, :related_object=>{:id=>"v_2P1uNm5WiyAmO1S5Fd1AnLmoYTs4ZEln", :type=>"voucher"}}}, :related_transaction_id=>nil, :created_at=>2024-07-24 07:15:14.336 UTC}], :has_more=>false} \ No newline at end of file diff --git a/__tests__/spec/snapshots/loyalties/updated_loyalty_member_card.snap b/__tests__/spec/snapshots/loyalties/updated_loyalty_member_card.snap new file mode 100644 index 00000000..f823c26a --- /dev/null +++ b/__tests__/spec/snapshots/loyalties/updated_loyalty_member_card.snap @@ -0,0 +1 @@ +{:points=>2000, :total=>13000, :balance=>13000, :type=>"loyalty_card", :object=>"balance", :related_object=>{:type=>"voucher", :id=>"v_2P1uNm5WiyAmO1S5Fd1AnLmoYTs4ZEln"}, :operation_type=>"MANUAL"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/orders/created_order.snap b/__tests__/spec/snapshots/orders/created_order.snap new file mode 100644 index 00000000..9996ea4b --- /dev/null +++ b/__tests__/spec/snapshots/orders/created_order.snap @@ -0,0 +1 @@ +{:id=>"ord_0f1a05f696156bea39", :source_id=>nil, :created_at=>2024-07-23 19:53:51.446 UTC, :updated_at=>nil, :status=>"CREATED", :amount=>10000, :total_amount=>10000, :items=>[{:product_id=>"test_order_item1", :quantity=>1, :object=>"order_item"}, {:product_id=>"test_order_item2", :quantity=>1, :object=>"order_item"}], :customer_id=>nil, :referrer_id=>nil, :object=>"order"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/orders/list_orders.snap b/__tests__/spec/snapshots/orders/list_orders.snap new file mode 100644 index 00000000..029d8792 --- /dev/null +++ b/__tests__/spec/snapshots/orders/list_orders.snap @@ -0,0 +1 @@ +{:object=>"list", :data_ref=>"orders", :orders=>[{:id=>"ord_0f1a05f696156bea39", :source_id=>nil, :created_at=>2024-07-23 19:53:51.446 UTC, :updated_at=>2024-07-23 19:53:51.605 UTC, :status=>"PAID", :amount=>30000, :total_amount=>30000, :items=>[{:product_id=>"test_order_item1", :quantity=>1, :object=>"order_item"}, {:product_id=>"test_order_item2", :quantity=>1, :object=>"order_item"}], :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a05f46ad56be9c2", :source_id=>nil, :created_at=>2024-07-23 19:53:51.222 UTC, :updated_at=>2024-07-23 19:53:51.243 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a05f1744805fc0d", :source_id=>nil, :created_at=>2024-07-23 19:53:46.593 UTC, :updated_at=>2024-07-23 19:53:46.606 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a05af58156be396", :source_id=>nil, :created_at=>2024-07-23 19:52:40.498 UTC, :updated_at=>2024-07-23 19:52:40.52 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a05a76f035fab05", :source_id=>nil, :created_at=>2024-07-23 19:52:30.792 UTC, :updated_at=>2024-07-23 19:52:30.808 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a03e3bc556bc24b", :source_id=>nil, :created_at=>2024-07-23 19:44:49.835 UTC, :updated_at=>2024-07-23 19:44:49.856 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a03e0b34805d723", :source_id=>nil, :created_at=>2024-07-23 19:44:45.147 UTC, :updated_at=>2024-07-23 19:44:45.162 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a032617035ffcc1", :source_id=>nil, :created_at=>2024-07-23 19:41:35.668 UTC, :updated_at=>2024-07-23 19:41:35.685 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a0322e0156bb314", :source_id=>nil, :created_at=>2024-07-23 19:41:30.762 UTC, :updated_at=>2024-07-23 19:41:30.775 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, {:id=>"ord_0f1a02b90e156ba9d4", :source_id=>nil, :created_at=>2024-07-23 19:39:43.966 UTC, :updated_at=>2024-07-23 19:39:43.984 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}], :total=>873} \ No newline at end of file diff --git a/__tests__/spec/snapshots/orders/updated_created_order_to_paid_status.snap b/__tests__/spec/snapshots/orders/updated_created_order_to_paid_status.snap new file mode 100644 index 00000000..2f973fdc --- /dev/null +++ b/__tests__/spec/snapshots/orders/updated_created_order_to_paid_status.snap @@ -0,0 +1 @@ +{:id=>"ord_0f1a05f696156bea39", :source_id=>nil, :created_at=>2024-07-23 19:53:51.446 UTC, :updated_at=>2024-07-23 19:53:51.605 UTC, :status=>"PAID", :amount=>30000, :total_amount=>30000, :items=>[{:product_id=>"test_order_item1", :quantity=>1, :object=>"order_item"}, {:product_id=>"test_order_item2", :quantity=>1, :object=>"order_item"}], :customer_id=>nil, :referrer_id=>nil, :object=>"order"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/added_sku_to_product.snap b/__tests__/spec/snapshots/products/added_sku_to_product.snap new file mode 100644 index 00000000..d4611af6 --- /dev/null +++ b/__tests__/spec/snapshots/products/added_sku_to_product.snap @@ -0,0 +1 @@ +{:id=>"sku_0f19725c9c461b91ec", :source_id=>"cZITJaY0E7", :product_id=>"prod_0f19725b46c61b91e1", :sku=>nil, :price=>5000, :currency=>nil, :attributes=>{:color=>"red", :memory=>"16GB", :processor=>"Intel Core i7"}, :image_url=>nil, :metadata=>{}, :created_at=>2024-07-23 09:08:58.609 UTC, :updated_at=>nil, :object=>"sku"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/created_product.snap b/__tests__/spec/snapshots/products/created_product.snap new file mode 100644 index 00000000..b851bdc4 --- /dev/null +++ b/__tests__/spec/snapshots/products/created_product.snap @@ -0,0 +1 @@ +{:id=>"prod_0f195744834fdfca4f", :source_id=>"4Y95wO6oqC", :name=>"5XBz3x85Ih", :price=>20000, :attributes=>["color", "memory", "processor"], :metadata=>{}, :image_url=>nil, :created_at=>2024-07-23 07:10:36.045 UTC, :updated_at=>nil, :object=>"product"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/created_product2.snap b/__tests__/spec/snapshots/products/created_product2.snap new file mode 100644 index 00000000..cc870ee9 --- /dev/null +++ b/__tests__/spec/snapshots/products/created_product2.snap @@ -0,0 +1 @@ +{:id=>"prod_0f195744834fdfca4f", :source_id=>"4Y95wO6oqC", :name=>"5XBz3x85Ih", :price=>60000, :attributes=>["color", "memory", "processor"], :metadata=>{}, :image_url=>nil, :created_at=>2024-07-23 07:10:36.045 UTC, :updated_at=>nil, :object=>"product"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/get_previously_created_product.snap b/__tests__/spec/snapshots/products/get_previously_created_product.snap new file mode 100644 index 00000000..e58eb1e3 --- /dev/null +++ b/__tests__/spec/snapshots/products/get_previously_created_product.snap @@ -0,0 +1 @@ +{:id=>"prod_0f196144c3061bd523", :source_id=>"MH0KpKo5Ca", :name=>"KIhOoH74Ze", :price=>20000, :attributes=>["color", "memory", "processor"], :metadata=>{}, :image_url=>nil, :created_at=>2024-07-23 07:54:17.74 UTC, :updated_at=>nil, :object=>"product"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/get_product_sku.snap b/__tests__/spec/snapshots/products/get_product_sku.snap new file mode 100644 index 00000000..c5046429 --- /dev/null +++ b/__tests__/spec/snapshots/products/get_product_sku.snap @@ -0,0 +1 @@ +{:id=>"sku_0f19725c9c461b91ec", :source_id=>"cZITJaY0E7", :product_id=>"prod_0f19725b46c61b91e1", :sku=>nil, :price=>2000, :currency=>nil, :attributes=>{:color=>"red", :memory=>"16GB", :processor=>"Intel Core i7"}, :image_url=>nil, :metadata=>{}, :created_at=>2024-07-23 09:08:58.609 UTC, :updated_at=>2024-07-23 09:08:58.689 UTC, :object=>"sku"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/list_skus.snap b/__tests__/spec/snapshots/products/list_skus.snap new file mode 100644 index 00000000..76481018 --- /dev/null +++ b/__tests__/spec/snapshots/products/list_skus.snap @@ -0,0 +1 @@ +{:object=>"list", :data_ref=>"skus", :skus=>[{:id=>"sku_0f1974063d1102f5a3", :source_id=>"HBiwAuJmmq", :product_id=>"prod_0f19740559cfdfbd84", :sku=>nil, :price=>2000, :currency=>nil, :attributes=>{:color=>"red", :memory=>"16GB", :processor=>"Intel Core i7"}, :image_url=>nil, :metadata=>{}, :created_at=>2024-07-23 09:16:14.452 UTC, :updated_at=>2024-07-23 09:16:14.527 UTC, :object=>"sku"}], :total=>1} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/updated_product_price.snap b/__tests__/spec/snapshots/products/updated_product_price.snap new file mode 100644 index 00000000..1080d018 --- /dev/null +++ b/__tests__/spec/snapshots/products/updated_product_price.snap @@ -0,0 +1 @@ +{:id=>"prod_0f1964f20c0fdf9bf0", :source_id=>"M8cUTbOMO9", :name=>"N5XKu3jQ9X", :price=>55000, :attributes=>["color", "memory", "processor"], :metadata=>{}, :image_url=>nil, :created_at=>2024-07-23 08:10:21.616 UTC, :updated_at=>2024-07-23 08:10:21.832 UTC, :object=>"product"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/products/updated_product_sku.snap b/__tests__/spec/snapshots/products/updated_product_sku.snap new file mode 100644 index 00000000..c5046429 --- /dev/null +++ b/__tests__/spec/snapshots/products/updated_product_sku.snap @@ -0,0 +1 @@ +{:id=>"sku_0f19725c9c461b91ec", :source_id=>"cZITJaY0E7", :product_id=>"prod_0f19725b46c61b91e1", :sku=>nil, :price=>2000, :currency=>nil, :attributes=>{:color=>"red", :memory=>"16GB", :processor=>"Intel Core i7"}, :image_url=>nil, :metadata=>{}, :created_at=>2024-07-23 09:08:58.609 UTC, :updated_at=>2024-07-23 09:08:58.689 UTC, :object=>"sku"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/publications/created_publication.snap b/__tests__/spec/snapshots/publications/created_publication.snap new file mode 100644 index 00000000..f9bc367d --- /dev/null +++ b/__tests__/spec/snapshots/publications/created_publication.snap @@ -0,0 +1 @@ +{:id=>"pub_DLbq474SeqKHuMqWg7ujUXE8DmkNlWx6", :object=>"publication", :created_at=>2024-07-23 12:33:22.881 UTC, :customer_id=>"cust_6vgE6l6SU0QJVa8O3UrVxN15", :tracking_id=>"0sHcrsmxdc", :metadata=>{}, :channel=>"API", :source_id=>nil, :result=>"SUCCESS", :customer=>{:name=>"John Doe", :address=>nil, :id=>"cust_6vgE6l6SU0QJVa8O3UrVxN15", :source_id=>"0sHcrsmxdc", :summary=>nil, :loyalty=>nil, :referrals=>nil, :object=>"customer"}, :vouchers_id=>["v_5AW6vEi03pQfsad0j6MiFb8F2ow4WE7v"], :voucher=>{:id=>"v_5AW6vEi03pQfsad0j6MiFb8F2ow4WE7v", :code=>"1ENFg5wA", :campaign_id=>"camp_y8zO25k2W1AWPagCSLEk1DJA", :category=>nil, :category_id=>nil, :categories=>[], :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :gift=>nil, :loyalty_card=>nil, :start_date=>nil, :expiration_date=>nil, :active=>true, :additional_info=>nil, :metadata=>{}, :assets=>{:qr=>{:id=>"58b6bf71-d962-4484-8094-c03114088db2", :url=>"https://dl.voucherify.io/api/v1/assets/qr/58b6bf71-d962-4484-8094-c03114088db2"}, :barcode=>{:id=>"af633eac-9639-4f8c-b0a3-c3a40bf896b3", :url=>"https://dl.voucherify.io/api/v1/assets/barcode/af633eac-9639-4f8c-b0a3-c3a40bf896b3"}}, :is_referral_code=>false, :created_at=>2024-07-23 12:33:21.986 UTC, :updated_at=>2024-07-23 12:33:22.887 UTC, :holder_id=>"cust_6vgE6l6SU0QJVa8O3UrVxN15", :object=>"voucher", :publish=>{:object=>"list", :count=>1, :url=>"/v1/vouchers/1ENFg5wA/publications?page=1&limit=10"}, :redemption=>{:quantity=>nil, :redeemed_quantity=>0, :object=>"list", :url=>"/v1/vouchers/1ENFg5wA/redemptions?page=1&limit=10"}}} diff --git a/__tests__/spec/snapshots/qualifications/checked_eligibility.snap b/__tests__/spec/snapshots/qualifications/checked_eligibility.snap new file mode 100644 index 00000000..c4056ad7 --- /dev/null +++ b/__tests__/spec/snapshots/qualifications/checked_eligibility.snap @@ -0,0 +1 @@ +{:redeemables=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"Z2DWJAJW", :object=>"voucher", :created_at=>2024-09-04 15:41:31.042 UTC, :result=>{}, :order=>{:amount=>20000, :total_amount=>20000, :metadata=>{}, :object=>"order", :customer_id=>nil, :referrer_id=>nil}, :applicable_to=>{}, :inapplicable_to=>{}}], :total=>1, :has_more=>true}, :tracking_id=>"track_scTenMhfDifgo6Lhiy2bfQ==", :order=>{:amount=>20000, :metadata=>{}, :object=>"order", :customer_id=>nil, :referrer_id=>nil}, :stacking_rules=>{}} diff --git a/__tests__/spec/snapshots/redemptions/redeem_stacked_applicable_discounts.snap b/__tests__/spec/snapshots/redemptions/redeem_stacked_applicable_discounts.snap new file mode 100644 index 00000000..50b97404 --- /dev/null +++ b/__tests__/spec/snapshots/redemptions/redeem_stacked_applicable_discounts.snap @@ -0,0 +1 @@ +{:redemptions=>[{:id=>"r_0f1a027ac2c35feebe", :object=>"redemption", :date=>2024-07-23 19:38:38.219 UTC, :metadata=>nil, :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f1a027a59035fee8a", :source_id=>nil, :created_at=>2024-07-23 19:38:38.2 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :applied_discount_amount=>0, :total_applied_discount_amount=>0, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, :voucher=>{:id=>"v_gEV33KabjnQlmsC63vi4uwX913cJPDGj", :code=>"89wNPhnh", :campaign_id=>"camp_aK9Bt0or55wJULNY1NHT1OXo", :category_id=>nil, :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :start_date=>nil, :expiration_date=>nil, :active=>true, :metadata=>{}, :is_referral_code=>false, :created_at=>2024-07-23 19:38:34.202 UTC, :updated_at=>2024-07-23 19:38:38.216 UTC, :holder_id=>"cust_tAXEl8AMNS8u3LsJa7YYZmLu", :object=>"voucher", :redemption=>{:quantity=>nil, :redeemed_quantity=>1, :object=>"list"}}}], :order=>{:id=>"ord_0f1a027a59035fee8a", :source_id=>nil, :created_at=>2024-07-23 19:38:38.2 UTC, :updated_at=>nil, :status=>"PAID", :amount=>20000, :total_amount=>20000, :applied_discount_amount=>0, :total_applied_discount_amount=>0, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, :inapplicable_redeemables=>[], :skipped_redeemables=>[]} diff --git a/__tests__/spec/snapshots/redemptions/redeem_stacked_skipped_discounts.snap b/__tests__/spec/snapshots/redemptions/redeem_stacked_skipped_discounts.snap new file mode 100644 index 00000000..f4e7d035 --- /dev/null +++ b/__tests__/spec/snapshots/redemptions/redeem_stacked_skipped_discounts.snap @@ -0,0 +1 @@ +{:redemptions=>[{:id=>"r_0f194e118fc61bbaad", :object=>"redemption", :date=>2024-07-23 06:30:24.575 UTC, :metadata=>nil, :redemption=>"r_0f194e118e061bbaac", :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :amount=>20000, :total_amount=>20000, :metadata=>{}, :object=>"order"}, :voucher=>{:id=>"v_WQMQ9HCC74rQNE4JY1sgeXiQlhIn8V27", :code=>"PlBMRQPe", :campaign_id=>"camp_YbDkurbbeo63f5ZnvSlRHGHv", :category_id=>nil, :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :start_date=>nil, :expiration_date=>nil, :active=>true, :metadata=>{}, :is_referral_code=>false, :created_at=>2024-07-23 06:30:20.241 UTC, :updated_at=>2024-07-23 06:30:24.569 UTC, :object=>"voucher", :redemption=>{:quantity=>nil, :redeemed_quantity=>1, :object=>"list"}}}, {:id=>"r_0f194e118fc61bbaae", :object=>"redemption", :date=>2024-07-23 06:30:24.575 UTC, :metadata=>nil, :redemption=>"r_0f194e118e061bbaac", :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :amount=>20000, :total_amount=>20000, :metadata=>{}, :object=>"order"}, :voucher=>{:id=>"v_7fMMnLeCbjahVqaOiZ0z3GRC8xP5i6JB", :code=>"qFXpSNKZ", :campaign=>"eBeAJePcZz", :campaign_id=>"camp_YbDkurbbeo63f5ZnvSlRHGHv", :category_id=>nil, :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :start_date=>nil, :expiration_date=>nil, :active=>true, :metadata=>{}, :is_referral_code=>false, :created_at=>2024-07-23 06:30:20.321 UTC, :updated_at=>2024-07-23 06:30:24.569 UTC, :object=>"voucher", :redemption=>{:quantity=>nil, :redeemed_quantity=>1, :object=>"list"}}}, {:id=>"r_0f194e118fc61bbaaf", :object=>"redemption", :date=>2024-07-23 06:30:24.575 UTC, :metadata=>nil, :redemption=>"r_0f194e118e061bbaac", :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :amount=>20000, :total_amount=>20000, :metadata=>{}, :object=>"order"}, :voucher=>{:id=>"v_n2AA3fwzoB9Lvb6a7EgSXDglKx3lEIpY", :code=>"fXMXbHZt", :campaign=>"eBeAJePcZz", :campaign_id=>"camp_YbDkurbbeo63f5ZnvSlRHGHv", :category_id=>nil, :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :start_date=>nil, :expiration_date=>nil, :active=>true, :metadata=>{}, :is_referral_code=>false, :created_at=>2024-07-23 06:30:20.401 UTC, :updated_at=>2024-07-23 06:30:24.569 UTC, :object=>"voucher", :redemption=>{:quantity=>nil, :redeemed_quantity=>1, :object=>"list"}}}, {:id=>"r_0f194e118fc61bbab0", :object=>"redemption", :date=>2024-07-23 06:30:24.575 UTC, :metadata=>nil, :redemption=>"r_0f194e118e061bbaac", :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :amount=>20000, :total_amount=>20000, :metadata=>{}, :object=>"order"}, :voucher=>{:id=>"v_slufMoAhCmeeGxEaQAZKMct007WC8zo1", :code=>"1BM6rc2H", :campaign=>"eBeAJePcZz", :campaign_id=>"camp_YbDkurbbeo63f5ZnvSlRHGHv", :category_id=>nil, :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :start_date=>nil, :expiration_date=>nil, :active=>true, :metadata=>{}, :is_referral_code=>false, :created_at=>2024-07-23 06:30:20.484 UTC, :updated_at=>2024-07-23 06:30:24.569 UTC, :object=>"voucher", :redemption=>{:quantity=>nil, :redeemed_quantity=>1, :object=>"list"}}}, {:id=>"r_0f194e118fc61bbab1", :object=>"redemption", :date=>2024-07-23 06:30:24.575 UTC, :metadata=>nil, :redemption=>"r_0f194e118e061bbaac", :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :amount=>20000, :total_amount=>20000, :metadata=>{}, :object=>"order"}, :voucher=>{:id=>"v_SthzYY0UPBdEjT18BTfGAga2yU0jvTy0", :code=>"gLSPeu7v", :campaign=>"eBeAJePcZz", :campaign_id=>"camp_YbDkurbbeo63f5ZnvSlRHGHv", :category_id=>nil, :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :start_date=>nil, :expiration_date=>nil, :active=>true, :metadata=>{}, :is_referral_code=>false, :created_at=>2024-07-23 06:30:20.634 UTC, :updated_at=>2024-07-23 06:30:24.569 UTC, :object=>"voucher", :redemption=>{:quantity=>nil, :redeemed_quantity=>1, :object=>"list"}}}], :parent_redemption=>{:id=>"r_0f194e118e061bbaac", :object=>"redemption", :date=>2024-07-23 06:30:24.575 UTC, :metadata=>nil, :result=>"SUCCESS", :status=>"SUCCEEDED", :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :created_at=>2024-07-23 06:30:24.558 UTC, :status=>"PAID", :amount=>20000, :total_amount=>20000, :applied_discount_amount=>0, :total_applied_discount_amount=>0, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}}, :order=>{:id=>"ord_0f194e1019861bba9c", :source_id=>nil, :created_at=>2024-07-23 06:30:24.558 UTC, :updated_at=>nil, :status=>"PAID", :amount=>20000, :total_amount=>20000, :applied_discount_amount=>0, :total_applied_discount_amount=>0, :metadata=>{}, :customer_id=>nil, :referrer_id=>nil, :object=>"order"}, :inapplicable_redeemables=>[], :skipped_redeemables=>[{:status=>"SKIPPED", :id=>"ZculyR1T", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"63N0AUZV", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"xqBlT7Du", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"ImrOXU89", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"bpoEYo6d", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"MTJ0zRcs", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"Ygiwtqob", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"w2qPOubz", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"klKw2FLm", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"lPYtawXI", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"ZK1vmfJi", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"zwR91a6W", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"aCH78rSf", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"wI117BUk", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"3cCpJQoQ", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"8R6PIfYc", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"GS5ezW8t", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"75SUhZty", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"5TfhtGxm", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"3iJ92cjw", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"UDFCLdwo", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"Jbob0r4E", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"BDbIgZhw", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"ySxJSuxF", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}, {:status=>"SKIPPED", :id=>"MGNlYMdz", :object=>"voucher", :result=>{:details=>{:key=>"applicable_redeemables_limit_exceeded", :message=>"Applicable redeemables limit exceeded"}}, :metadata=>{}}]} diff --git a/__tests__/spec/snapshots/validation_rules/created_validation_rule_assignment.snap b/__tests__/spec/snapshots/validation_rules/created_validation_rule_assignment.snap new file mode 100644 index 00000000..444eb6f1 --- /dev/null +++ b/__tests__/spec/snapshots/validation_rules/created_validation_rule_assignment.snap @@ -0,0 +1 @@ +{:id=>"asgm_lUyF1i7aNfYqsPpS", :rule_id=>"val_1AP52Rv2BLAH", :related_object_id=>"v_7sWatjDPW1euTMaGk9BdtJ3223m6iftW", :related_object_type=>"voucher", :created_at=>2024-07-24 07:15:23.268 UTC, :object=>"validation_rules_assignment"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/validations/applicable_stacked_validation.snap b/__tests__/spec/snapshots/validations/applicable_stacked_validation.snap new file mode 100644 index 00000000..c4a8b53f --- /dev/null +++ b/__tests__/spec/snapshots/validations/applicable_stacked_validation.snap @@ -0,0 +1 @@ +{:valid=>true, :redeemables=>[{:status=>"APPLICABLE", :id=>"uvpwFwUq", :object=>"voucher", :order=>{:amount=>20000, :items_discount_amount=>1000, :total_discount_amount=>1000, :total_amount=>19000, :items_applied_discount_amount=>1000, :total_applied_discount_amount=>1000, :items=>[{:product_id=>"prod_0f12e3b6979102f711", :related_object=>"product", :quantity=>1, :discount_quantity=>1, :amount=>20000, :discount_amount=>1000, :applied_discount_amount=>1000, :price=>20000, :subtotal_amount=>19000, :product=>{:id=>"prod_0f12e3b6979102f711"}, :object=>"order_item"}], :metadata=>{}, :customer_id=>"cust_Ad9sAC67TWG7TW17g7gFk8Ik", :referrer_id=>nil, :object=>"order", :customer=>{:id=>"cust_Ad9sAC67TWG7TW17g7gFk8Ik", :object=>"customer"}}, :applicable_to=>{:data=>[{:object=>"product", :id=>"prod_0f12e3b6979102f711", :strict=>false, :effect=>"APPLY_TO_EVERY", :order_item_indices=>[0]}], :total=>1, :object=>"list", :data_ref=>"data"}, :inapplicable_to=>{:data=>[], :total=>0, :object=>"list", :data_ref=>"data"}, :result=>{:discount=>{:type=>"AMOUNT", :amount_off=>1000.0, :effect=>"APPLY_TO_ITEMS", :is_dynamic=>false}}, :metadata=>{}}], :order=>{:amount=>20000, :items_discount_amount=>1000, :total_discount_amount=>1000, :total_amount=>19000, :items_applied_discount_amount=>1000, :total_applied_discount_amount=>1000, :items=>[{:product_id=>"prod_0f12e3b6979102f711", :related_object=>"product", :quantity=>1, :discount_quantity=>1, :amount=>20000, :discount_amount=>1000, :applied_discount_amount=>1000, :price=>20000, :subtotal_amount=>19000, :product=>{:id=>"prod_0f12e3b6979102f711"}, :object=>"order_item"}], :metadata=>{}, :customer_id=>"cust_Ad9sAC67TWG7TW17g7gFk8Ik", :referrer_id=>nil, :object=>"order", :customer=>{:id=>"cust_Ad9sAC67TWG7TW17g7gFk8Ik", :object=>"customer"}}, :tracking_id=>"track_xW97+jMGrs3w4fKeZ7khHQ==", :stacking_rules=>{}} diff --git a/__tests__/spec/snapshots/validations/inapplicable_stacked_validation.snap b/__tests__/spec/snapshots/validations/inapplicable_stacked_validation.snap new file mode 100644 index 00000000..b5febd5e --- /dev/null +++ b/__tests__/spec/snapshots/validations/inapplicable_stacked_validation.snap @@ -0,0 +1 @@ +{:valid=>false, :tracking_id=>"track_zenNrTA+7PuHSEodU6NVow==", :stacking_rules=>{}} diff --git a/__tests__/spec/snapshots/validations/redeemable_items_necessary_keys.snap b/__tests__/spec/snapshots/validations/redeemable_items_necessary_keys.snap new file mode 100644 index 00000000..a34be11c --- /dev/null +++ b/__tests__/spec/snapshots/validations/redeemable_items_necessary_keys.snap @@ -0,0 +1 @@ +{:status=>"APPLICABLE", :object=>"voucher", :order=>{:amount=>20000, :items_discount_amount=>1000, :total_discount_amount=>1000, :total_amount=>19000, :items_applied_discount_amount=>1000, :total_applied_discount_amount=>1000, :items=>[{:product_id=>"prod_0f14837efe461b857c", :related_object=>"product", :quantity=>1, :discount_quantity=>1, :amount=>20000, :discount_amount=>1000, :applied_discount_amount=>1000, :price=>20000, :subtotal_amount=>19000, :product=>{:id=>"prod_0f14837efe461b857c"}, :object=>"order_item"}], :metadata=>{}, :customer_id=>"cust_KoSWCY2IYrWAYouZ9RvBQI7c", :referrer_id=>nil, :object=>"order", :customer=>{:id=>"cust_KoSWCY2IYrWAYouZ9RvBQI7c", :object=>"customer"}}, :applicable_to=>{:data=>[{:object=>"product", :id=>"prod_0f14837efe461b857c", :strict=>false, :effect=>"APPLY_TO_EVERY", :order_item_indices=>[0]}], :total=>1, :object=>"list", :data_ref=>"data"}, :inapplicable_to=>{:data=>[], :total=>0, :object=>"list", :data_ref=>"data"}, :result=>{:discount=>{:type=>"AMOUNT", :amount_off=>1000.0, :effect=>"APPLY_TO_ITEMS", :is_dynamic=>false}}, :metadata=>{}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/validations/validations_succesful_order.snap b/__tests__/spec/snapshots/validations/validations_succesful_order.snap new file mode 100644 index 00000000..43dab1d9 --- /dev/null +++ b/__tests__/spec/snapshots/validations/validations_succesful_order.snap @@ -0,0 +1 @@ +{:amount=>20000, :items_discount_amount=>1000, :total_discount_amount=>1000, :total_amount=>19000, :items_applied_discount_amount=>1000, :total_applied_discount_amount=>1000, :items=>[{:product_id=>"prod_0f1485fe890fdfa04c", :related_object=>"product", :quantity=>1, :discount_quantity=>1, :amount=>20000, :discount_amount=>1000, :applied_discount_amount=>1000, :price=>20000, :subtotal_amount=>19000, :product=>{:id=>"prod_0f1485fe890fdfa04c"}, :object=>"order_item"}], :metadata=>{}, :customer_id=>"cust_224bSBrXn787wpNLOBeIXfGf", :referrer_id=>nil, :object=>"order", :customer=>{:id=>"cust_224bSBrXn787wpNLOBeIXfGf", :object=>"customer"}} \ No newline at end of file diff --git a/__tests__/spec/snapshots/validations_rules/created_validation_rule_assignment.snap b/__tests__/spec/snapshots/validations_rules/created_validation_rule_assignment.snap new file mode 100644 index 00000000..444eb6f1 --- /dev/null +++ b/__tests__/spec/snapshots/validations_rules/created_validation_rule_assignment.snap @@ -0,0 +1 @@ +{:id=>"asgm_lUyF1i7aNfYqsPpS", :rule_id=>"val_1AP52Rv2BLAH", :related_object_id=>"v_7sWatjDPW1euTMaGk9BdtJ3223m6iftW", :related_object_type=>"voucher", :created_at=>2024-07-24 07:15:23.268 UTC, :object=>"validation_rules_assignment"} \ No newline at end of file diff --git a/__tests__/spec/snapshots/vouchers/disabled_previously_created_voucher.snap b/__tests__/spec/snapshots/vouchers/disabled_previously_created_voucher.snap new file mode 100644 index 00000000..70653574 --- /dev/null +++ b/__tests__/spec/snapshots/vouchers/disabled_previously_created_voucher.snap @@ -0,0 +1 @@ +{:id=>"v_bAR5IbtVW7cTumZX2xhhM8gXwRqh5Fzh", :code=>"pSQZKBbg", :campaign_id=>"camp_MI1Tx7bM0VLuxPZ0SLulKynt", :category=>nil, :category_id=>nil, :categories=>[], :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :gift=>nil, :loyalty_card=>nil, :start_date=>nil, :expiration_date=>nil, :active=>false, :additional_info=>nil, :metadata=>{}, :assets=>{:qr=>{:id=>"822ffcae-7d0d-4160-bb38-4dafb658b5a7", :url=>"https://dl.voucherify.io/api/v1/assets/qr/822ffcae-7d0d-4160-bb38-4dafb658b5a7"}, :barcode=>{:id=>"e25bda37-520c-40e7-b1d1-286832139c1c", :url=>"https://dl.voucherify.io/api/v1/assets/barcode/e25bda37-520c-40e7-b1d1-286832139c1c"}}, :is_referral_code=>false, :created_at=>2024-07-23 19:19:24.84 UTC, :updated_at=>2024-07-23 19:19:27.854 UTC, :holder_id=>"cust_vwTmznp5uly1bGPuTGGKEtez", :object=>"voucher", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"asgm_jo81MZXYzuXHf8Mn", :rule_id=>"val_DKimJLXDkh5A", :related_object_id=>"camp_MI1Tx7bM0VLuxPZ0SLulKynt", :related_object_type=>"campaign", :created_at=>2024-07-23 19:19:24.495 UTC, :object=>"validation_rules_assignment"}], :total=>1}, :publish=>{:object=>"list", :count=>1, :url=>"/v1/vouchers/pSQZKBbg/publications?page=1&limit=10"}, :redemption=>{:quantity=>nil, :redeemed_quantity=>0, :object=>"list", :url=>"/v1/vouchers/pSQZKBbg/redemptions?page=1&limit=10"}} diff --git a/__tests__/spec/snapshots/vouchers/enabled_previously_created_voucher.snap b/__tests__/spec/snapshots/vouchers/enabled_previously_created_voucher.snap new file mode 100644 index 00000000..d286c746 --- /dev/null +++ b/__tests__/spec/snapshots/vouchers/enabled_previously_created_voucher.snap @@ -0,0 +1 @@ +{:id=>"v_bAR5IbtVW7cTumZX2xhhM8gXwRqh5Fzh", :code=>"pSQZKBbg", :campaign_id=>"camp_MI1Tx7bM0VLuxPZ0SLulKynt", :category=>nil, :category_id=>nil, :categories=>[], :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :gift=>nil, :loyalty_card=>nil, :start_date=>nil, :expiration_date=>nil, :active=>true, :additional_info=>nil, :metadata=>{}, :assets=>{:qr=>{:id=>"822ffcae-7d0d-4160-bb38-4dafb658b5a7", :url=>"https://dl.voucherify.io/api/v1/assets/qr/822ffcae-7d0d-4160-bb38-4dafb658b5a7"}, :barcode=>{:id=>"e25bda37-520c-40e7-b1d1-286832139c1c", :url=>"https://dl.voucherify.io/api/v1/assets/barcode/e25bda37-520c-40e7-b1d1-286832139c1c"}}, :is_referral_code=>false, :created_at=>2024-07-23 19:19:24.84 UTC, :updated_at=>2024-07-23 19:19:27.927 UTC, :holder_id=>"cust_vwTmznp5uly1bGPuTGGKEtez", :object=>"voucher", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"asgm_jo81MZXYzuXHf8Mn", :rule_id=>"val_DKimJLXDkh5A", :related_object_id=>"camp_MI1Tx7bM0VLuxPZ0SLulKynt", :related_object_type=>"campaign", :created_at=>2024-07-23 19:19:24.495 UTC, :object=>"validation_rules_assignment"}], :total=>1}, :publish=>{:object=>"list", :count=>1, :url=>"/v1/vouchers/pSQZKBbg/publications?page=1&limit=10"}, :redemption=>{:quantity=>nil, :redeemed_quantity=>0, :object=>"list", :url=>"/v1/vouchers/pSQZKBbg/redemptions?page=1&limit=10"}} diff --git a/__tests__/spec/snapshots/vouchers/get_previously_created_voucher.snap b/__tests__/spec/snapshots/vouchers/get_previously_created_voucher.snap new file mode 100644 index 00000000..344fb2fe --- /dev/null +++ b/__tests__/spec/snapshots/vouchers/get_previously_created_voucher.snap @@ -0,0 +1 @@ +{:id=>"v_bAR5IbtVW7cTumZX2xhhM8gXwRqh5Fzh", :code=>"pSQZKBbg", :campaign_id=>"camp_MI1Tx7bM0VLuxPZ0SLulKynt", :category=>nil, :category_id=>nil, :categories=>[], :type=>"DISCOUNT_VOUCHER", :discount=>{:type=>"AMOUNT", :amount_off=>1000.0}, :gift=>nil, :loyalty_card=>nil, :start_date=>nil, :expiration_date=>nil, :active=>true, :additional_info=>nil, :metadata=>{}, :assets=>{:qr=>{:id=>"822ffcae-7d0d-4160-bb38-4dafb658b5a7", :url=>"https://dl.voucherify.io/api/v1/assets/qr/822ffcae-7d0d-4160-bb38-4dafb658b5a7"}, :barcode=>{:id=>"e25bda37-520c-40e7-b1d1-286832139c1c", :url=>"https://dl.voucherify.io/api/v1/assets/barcode/e25bda37-520c-40e7-b1d1-286832139c1c"}}, :is_referral_code=>false, :created_at=>2024-07-23 19:19:24.84 UTC, :updated_at=>2024-07-23 19:19:25.741 UTC, :holder_id=>"cust_vwTmznp5uly1bGPuTGGKEtez", :object=>"voucher", :validation_rules_assignments=>{:object=>"list", :data_ref=>"data", :data=>[{:id=>"asgm_jo81MZXYzuXHf8Mn", :rule_id=>"val_DKimJLXDkh5A", :related_object_id=>"camp_MI1Tx7bM0VLuxPZ0SLulKynt", :related_object_type=>"campaign", :created_at=>2024-07-23 19:19:24.495 UTC, :object=>"validation_rules_assignment"}], :total=>1}, :publish=>{:object=>"list", :count=>1, :url=>"/v1/vouchers/pSQZKBbg/publications?page=1&limit=10"}, :redemption=>{:quantity=>nil, :redeemed_quantity=>0, :object=>"list", :url=>"/v1/vouchers/pSQZKBbg/redemptions?page=1&limit=10"}} diff --git a/__tests__/spec/snapshots/vouchers/updated_loyalty_card_balance.snap b/__tests__/spec/snapshots/vouchers/updated_loyalty_card_balance.snap new file mode 100644 index 00000000..d982ccf9 --- /dev/null +++ b/__tests__/spec/snapshots/vouchers/updated_loyalty_card_balance.snap @@ -0,0 +1 @@ +{:amount=>10000, :total=>11000, :balance=>11000, :type=>"loyalty_card", :operation_type=>"MANUAL", :object=>"balance", :related_object=>{:type=>"voucher"}} diff --git a/__tests__/spec/support/get_snapshot_without_uniq_keys.rb b/__tests__/spec/support/get_snapshot_without_uniq_keys.rb new file mode 100644 index 00000000..ecef4b18 --- /dev/null +++ b/__tests__/spec/support/get_snapshot_without_uniq_keys.rb @@ -0,0 +1,47 @@ +# spec/support/remove_keys.rb +require_relative 'snapshot_helper' + +def get_snapshot_without_uniq_keys(snapshot_name, keys_to_remove = nil) + keys_to_remove ||= ['id', 'created_at', 'updated_at', 'name', 'rule_id', 'customer_id', 'related_object_id', 'source_id', 'product_id', 'promotion_id', 'campaign_id', 'banner', 'code', 'date', 'voucher_id', 'rule_id', 'related_object_id', 'url', 'tracking_id', 'vouchers_id', 'holder_id'] + + # Load snapshot + snapshot = load_snapshot(snapshot_name) + + # Convert snapshot to hash + gsub_snapshot = snapshot.gsub(/:(\w+|\$[\w\$]+|".+?"|'.+?')\s*=>/, '"\1":').gsub(/""(.*?)""/, '"\1"').gsub("'", '"').gsub(":nil", ":null").gsub(/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{1,3} UTC)/, '"\1"') + hashed_snapshot = JSON.parse(gsub_snapshot) + + + # Remove specified keys from both hashes + filtered_snapshot = deep_symbolize_keys(remove_keys(hashed_snapshot, keys_to_remove)) + + return filtered_snapshot +end + +def remove_keys(hash, keys) + hash.each do |key, value| + if value.is_a?(Hash) + remove_keys(value, keys) + elsif value.is_a?(Array) + value.each do |item| + remove_keys(item, keys) if item.is_a?(Hash) + end + end + hash.delete(key) if keys.include?(key) + end +end + + +def deep_symbolize_keys(data) + case data + when Hash + data.each_with_object({}) do |(key, value), result| + new_key = key.to_sym rescue key + result[new_key] = deep_symbolize_keys(value) + end + when Array + data.map { |item| deep_symbolize_keys(item) } + else + data + end +end diff --git a/__tests__/spec/support/snapshot_helper.rb b/__tests__/spec/support/snapshot_helper.rb new file mode 100644 index 00000000..a6e2d1bb --- /dev/null +++ b/__tests__/spec/support/snapshot_helper.rb @@ -0,0 +1,15 @@ +# __tests__/spec/support/snapshot_helper.rb +# +module SnapshotHelper + SNAPSHOT_DIR = File.expand_path('../../snapshots', __FILE__) + + def load_snapshot(path) + snapshot_file = File.join(SNAPSHOT_DIR, "#{path}.snap") + raise "Snapshot file #{snapshot_file} does not exist" unless File.exist?(snapshot_file) + File.read(snapshot_file) + end +end + +RSpec.configure do |config| + config.include SnapshotHelper +end \ No newline at end of file diff --git a/__tests__/spec/support/validate_deep_match.rb b/__tests__/spec/support/validate_deep_match.rb new file mode 100644 index 00000000..06f0d814 --- /dev/null +++ b/__tests__/spec/support/validate_deep_match.rb @@ -0,0 +1,41 @@ +# spec/support/deep_match.rb + +def deep_match?(snapshot, result, path = [], errors = []) + if snapshot.is_a?(Hash) + snapshot.each do |key, value| + current_path = path + [key] + if result.is_a?(Hash) && result.key?(key) + deep_match?(value, result[key], current_path, errors) + elsif result.respond_to?(key) + deep_match?(value, result.send(key), current_path, errors) + else + errors << "Key #{current_path.join('->')} not found in result" + end + end + elsif snapshot.is_a?(Array) + if snapshot.length != result.length + errors << "Array length mismatch at #{path.join('->')}: snapshot #{snapshot.length}, result #{result.length}" + else + snapshot.each_with_index do |item, index| + unless deep_match?(item, result[index], path + ["[#{index}]"], errors) + errors << "Array item mismatch at #{path.join('->')}[#{index}]" + end + end + end + else + unless snapshot == result + errors << "Value mismatch at #{path.join('->')}: snapshot #{snapshot}, result #{result}" + end + end + + errors.empty? +end + +def validate_deep_match(snapshot, result) + errors = [] + if deep_match?(snapshot, result, [], errors) + true + else + raise "Deep match failed:\n" + errors.join("\n") + end +end diff --git a/docs/AccessSettingsCampaignAssignmentsList.md b/docs/AccessSettingsCampaignAssignmentsList.md new file mode 100644 index 00000000..32b7fa82 --- /dev/null +++ b/docs/AccessSettingsCampaignAssignmentsList.md @@ -0,0 +1,11 @@ +# VoucherifySdk::AccessSettingsCampaignAssignmentsList + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. Default is `list`. This object stores information about campaign assignments to areas and stores | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of campaign assignments. | [optional][default to 'data'] | +| **data** | [**Array<AreaStoreCampaignAssignment>**](AreaStoreCampaignAssignment.md) | Contains an array of campaign assignments. | [optional] | +| **total** | **Integer** | Total number of areas and stores to which the campaign is assigned. | [optional] | + diff --git a/docs/Any.md b/docs/Any.md deleted file mode 100644 index 65630718..00000000 --- a/docs/Any.md +++ /dev/null @@ -1,53 +0,0 @@ -# VoucherifySdk::Any - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::Any.openapi_one_of -# => -# [ -# :'Array', -# :'Float', -# :'Object', -# :'String' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::Any.build(data) -# => #:0x00007fdd4aab02a0> - -VoucherifySdk::Any.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `Array` -- `Float` -- `Object` -- `String` -- `nil` (if no type matches) - diff --git a/docs/ApplicableTo.md b/docs/ApplicableTo.md index a78c0118..92b20cef 100644 --- a/docs/ApplicableTo.md +++ b/docs/ApplicableTo.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | This object stores information about the product collection. | | -| **id** | **String** | Unique product collection ID assigned by Voucherify. | | +| **object** | **String** | This object stores information about the product collection. | [optional] | +| **id** | **String** | Unique product collection ID assigned by Voucherify. | [optional] | | **source_id** | **String** | The source ID from your inventory system. | [optional] | | **product_id** | **String** | Parent product's unique ID assigned by Voucherify. | [optional] | | **product_source_id** | **String** | Parent product's source ID from your inventory system. | [optional] | -| **strict** | **Boolean** | | | +| **strict** | **Boolean** | | [optional] | | **price** | **Float** | New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. | [optional] | | **price_formula** | **Float** | Formula used to calculate the discounted price of an item. | [optional] | | **effect** | [**ApplicableToEffect**](ApplicableToEffect.md) | | | @@ -18,4 +18,7 @@ | **amount_limit** | **Integer** | Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] | | **aggregated_amount_limit** | **Integer** | 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) | [optional] | | **order_item_indices** | **Array<Integer>** | | [optional] | +| **repeat** | **Integer** | | [optional] | +| **skip_initially** | **Integer** | | [optional] | +| **target** | **String** | | [optional] | diff --git a/docs/ApplicableToResultList.md b/docs/ApplicableToResultList.md index b56cefbf..1cb0911a 100644 --- a/docs/ApplicableToResultList.md +++ b/docs/ApplicableToResultList.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **data** | [**Array<ApplicableTo>**](ApplicableTo.md) | Contains array of items to which the discount can apply. | | -| **total** | **Integer** | Total number of objects defining included products, SKUs, or product collections. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'list'] | -| **data_ref** | **String** | The type of object represented by JSON. | [default to 'data'] | +| **data** | [**Array<ApplicableTo>**](ApplicableTo.md) | Contains array of items to which the discount can apply. | [optional] | +| **total** | **Integer** | Total number of objects defining included products, SKUs, or product collections. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | The type of the object represented by JSON. | [optional][default to 'data'] | diff --git a/docs/AreaStoreCampaignAssignment.md b/docs/AreaStoreCampaignAssignment.md new file mode 100644 index 00000000..4aae6d1a --- /dev/null +++ b/docs/AreaStoreCampaignAssignment.md @@ -0,0 +1,12 @@ +# VoucherifySdk::AreaStoreCampaignAssignment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of the campaign assignment. | [optional] | +| **area_id** | **String** | Unique identifier of the area to which the campaign is assigned. | [optional] | +| **area_store_id** | **String** | Unique identifier of the store to which the campaign is assigned. | [optional] | +| **created_at** | **Time** | Date and time when the assignment was made. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign assignment to areas or stores. | [optional][default to 'area_store_campaign_assignment'] | + diff --git a/docs/ArrayInner.md b/docs/ArrayInner.md deleted file mode 100644 index 8d883f4c..00000000 --- a/docs/ArrayInner.md +++ /dev/null @@ -1,51 +0,0 @@ -# VoucherifySdk::ArrayInner - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ArrayInner.openapi_one_of -# => -# [ -# :'Float', -# :'Object', -# :'String' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ArrayInner.build(data) -# => # - -VoucherifySdk::ArrayInner.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `Float` -- `Object` -- `String` -- `nil` (if no type matches) - diff --git a/docs/AsyncActionBase.md b/docs/AsyncActionBase.md new file mode 100644 index 00000000..cdab2ccb --- /dev/null +++ b/docs/AsyncActionBase.md @@ -0,0 +1,17 @@ +# VoucherifySdk::AsyncActionBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Async action unique ID. | [optional] | +| **type** | **String** | Type of async action. | [optional] | +| **status** | **String** | Status of the async action. Informs you whether the async action has already been completed. | [optional] | +| **operation_status** | **String** | Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. | [optional] | +| **request_id** | **String** | Unique request ID. | [optional] | +| **processing_time** | **Integer** | The length of time it took to process the request in milliseconds. | [optional] | +| **progress** | **Integer** | % progress to completion of the asynchronous action. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the `async_action`. | [optional][default to 'async_action'] | + diff --git a/docs/AsyncActionGetResponseBody.md b/docs/AsyncActionGetResponseBody.md new file mode 100644 index 00000000..cffa0cf8 --- /dev/null +++ b/docs/AsyncActionGetResponseBody.md @@ -0,0 +1,18 @@ +# VoucherifySdk::AsyncActionGetResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Async action unique ID. | [optional] | +| **type** | **String** | Type of async action. | [optional] | +| **status** | **String** | Status of the async action. Informs you whether the async action has already been completed. | [optional] | +| **operation_status** | **String** | Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. | [optional] | +| **request_id** | **String** | Unique request ID. | [optional] | +| **processing_time** | **Integer** | The length of time it took to process the request in milliseconds. | [optional] | +| **progress** | **Integer** | % progress to completion of the asynchronous action. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the `async_action`. | [optional][default to 'async_action'] | +| **result** | **Object** | | [optional] | + diff --git a/docs/AsyncActions.md b/docs/AsyncActions.md deleted file mode 100644 index 305d4c44..00000000 --- a/docs/AsyncActions.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::AsyncActions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | - diff --git a/docs/AsyncActionsApi.md b/docs/AsyncActionsApi.md new file mode 100644 index 00000000..cc633552 --- /dev/null +++ b/docs/AsyncActionsApi.md @@ -0,0 +1,129 @@ +# VoucherifySdk::AsyncActionsApi + +All URIs are relative to *https://api.voucherify.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_async_action**](AsyncActionsApi.md#get_async_action) | **GET** /v1/async-actions/{asyncActionId} | Get Async Action | +| [**list_async_actions**](AsyncActionsApi.md#list_async_actions) | **GET** /v1/async-actions | List Async Actions | + + +## get_async_action + +> get_async_action(async_action_id) + +Get Async Action + +Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::AsyncActionsApi.new +async_action_id = 'async_action_id_example' # String | Unique ID of the asynchronous operation. + +begin + # Get Async Action + result = api_instance.get_async_action(async_action_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling AsyncActionsApi->get_async_action: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **async_action_id** | **String** | Unique ID of the asynchronous operation. | | + +### Return type + +[**AsyncActionGetResponseBody**](AsyncActionGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## list_async_actions + +> list_async_actions(opts) + +List Async Actions + +Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::AsyncActionsApi.new +opts = { + limit: 56, # Integer | Limit the number of asynchronous actions that the API returns in the response. + end_date: Time.parse('2013-10-20T19:20:30+01:00') # Time | Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). +} + +begin + # List Async Actions + result = api_instance.list_async_actions(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling AsyncActionsApi->list_async_actions: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **limit** | **Integer** | Limit the number of asynchronous actions that the API returns in the response. | [optional] | +| **end_date** | **Time** | Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). | [optional] | + +### Return type + +[**AsyncActionsListResponseBody**](AsyncActionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/AsyncActionsListResponseBody.md b/docs/AsyncActionsListResponseBody.md new file mode 100644 index 00000000..a673e1a2 --- /dev/null +++ b/docs/AsyncActionsListResponseBody.md @@ -0,0 +1,10 @@ +# VoucherifySdk::AsyncActionsListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about asynchronous actions. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of asynchronous actions. | [optional][default to 'async_actions'] | +| **async_actions** | [**Array<AsyncActionBase>**](AsyncActionBase.md) | | [optional] | + diff --git a/docs/BusValRuleAssignment.md b/docs/BusValRuleAssignment.md index f8a6a93b..ac8c6bf7 100644 --- a/docs/BusValRuleAssignment.md +++ b/docs/BusValRuleAssignment.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | The unique identifier for a assignment | | -| **rule_id** | **String** | The unique identifier for a rule | | -| **related_object_id** | **String** | The unique identifier for a related object | | -| **related_object_type** | **String** | The type of related object | | -| **created_at** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | +| **id** | **String** | The unique identifier for a assignment | [optional] | +| **rule_id** | **String** | The unique identifier for a rule | [optional] | +| **related_object_id** | **String** | The unique identifier for a related object | [optional] | +| **related_object_type** | **String** | The type of related object | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the object was last updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'validation_rules_assignment'] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'validation_rules_assignment'] | | **validation_status** | **String** | The validation status of the assignment | [optional] | | **validation_omitted_rules** | **Array<String>** | The list of omitted rules | [optional] | diff --git a/docs/Campaign.md b/docs/Campaign.md deleted file mode 100644 index 5e792342..00000000 --- a/docs/Campaign.md +++ /dev/null @@ -1,37 +0,0 @@ -# VoucherifySdk::Campaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **name** | **String** | Campaign name. | | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **campaign_type** | **String** | Type of campaign. | | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | | -| **voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was updated in ISO 8601 format. | [optional] | -| **category** | **String** | Unique category name. | [optional] | -| **creation_status** | **String** | Indicates the status of the campaign creation. | | -| **vouchers_generation_status** | **String** | Indicates the status of the campaign's vouchers. | | -| **protected** | **Boolean** | Indicates whether the resource can be deleted. | | -| **category_id** | **String** | Unique category ID that this campaign belongs to. | | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the campaign. | [default to 'campaign'] | -| **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | -| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | -| **promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] | -| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | - diff --git a/docs/CampaignBase.md b/docs/CampaignBase.md index fe81e5e9..9f27781c 100644 --- a/docs/CampaignBase.md +++ b/docs/CampaignBase.md @@ -4,32 +4,33 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **name** | **String** | Campaign name. | | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | | **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **campaign_type** | **String** | Type of campaign. | | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | | +| **campaign_type** | **String** | Type of campaign. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | | **voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | | **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | | **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | | **category** | **String** | Unique category name. | [optional] | -| **creation_status** | **String** | Indicates the status of the campaign creation. | | -| **vouchers_generation_status** | **String** | Indicates the status of the campaign's vouchers. | | -| **protected** | **Boolean** | Indicates whether the resource can be deleted. | | -| **category_id** | **String** | Unique category ID that this campaign belongs to. | | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the campaign. | [default to 'campaign'] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | | **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | | **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | diff --git a/docs/CampaignBaseValidityTimeframe.md b/docs/CampaignBaseValidityTimeframe.md deleted file mode 100644 index b4751f6e..00000000 --- a/docs/CampaignBaseValidityTimeframe.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::CampaignBaseValidityTimeframe - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **interval** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day. | [optional] | -| **duration** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day. | [optional] | - diff --git a/docs/CampaignLoyaltyCard.md b/docs/CampaignLoyaltyCard.md index a3df9e42..f2ab120d 100644 --- a/docs/CampaignLoyaltyCard.md +++ b/docs/CampaignLoyaltyCard.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. | | +| **points** | **Integer** | The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. | [optional] | | **expiration_rules** | [**CampaignLoyaltyCardExpirationRules**](CampaignLoyaltyCardExpirationRules.md) | | [optional] | diff --git a/docs/CampaignLoyaltyCardExpirationRules.md b/docs/CampaignLoyaltyCardExpirationRules.md index 817abb8e..4607a2f8 100644 --- a/docs/CampaignLoyaltyCardExpirationRules.md +++ b/docs/CampaignLoyaltyCardExpirationRules.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **period_type** | **String** | Type of period | | -| **period_value** | **Integer** | Value of the period | | -| **rounding_type** | **String** | Type of rounding | | -| **rounding_value** | **Integer** | Value of rounding | | +| **period_type** | **String** | Type of period | [optional][default to 'MONTH'] | +| **period_value** | **Integer** | Value of the period | [optional] | +| **rounding_type** | **String** | Type of rounding | [optional] | +| **rounding_value** | **Integer** | Value of rounding | [optional] | diff --git a/docs/CampaignLoyaltyVoucher.md b/docs/CampaignLoyaltyVoucher.md index 424d6298..f5b58e84 100644 --- a/docs/CampaignLoyaltyVoucher.md +++ b/docs/CampaignLoyaltyVoucher.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of voucher. | [default to 'LOYALTY_CARD'] | +| **type** | **String** | Type of voucher. | [optional][default to 'LOYALTY_CARD'] | | **loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | | | **redemption** | [**CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] | | **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | diff --git a/docs/CampaignVoucher.md b/docs/CampaignVoucher.md index 10bd2542..f7482bf3 100644 --- a/docs/CampaignVoucher.md +++ b/docs/CampaignVoucher.md @@ -4,14 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of voucher. | [default to 'DISCOUNT_VOUCHER'] | +| **type** | **String** | Type of voucher. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | | **gift** | [**Gift**](Gift.md) | | [optional] | | **loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] | -| **redemption** | [**CampaignVoucherRedemption**](CampaignVoucherRedemption.md) | | | -| **code_config** | [**CodeConfigRequiredLengthCharsetPattern**](CodeConfigRequiredLengthCharsetPattern.md) | | | -| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | | +| **redemption** | [**CampaignVoucherRedemption**](CampaignVoucherRedemption.md) | | [optional] | +| **code_config** | [**CodeConfig**](CodeConfig.md) | | | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | diff --git a/docs/CampaignVoucherRedemption.md b/docs/CampaignVoucherRedemption.md index 01ee10d8..c9a17d4e 100644 --- a/docs/CampaignVoucherRedemption.md +++ b/docs/CampaignVoucherRedemption.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | diff --git a/docs/CampaignsApi.md b/docs/CampaignsApi.md index 5a5c01b9..85f4bc99 100644 --- a/docs/CampaignsApi.md +++ b/docs/CampaignsApi.md @@ -44,7 +44,7 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::CampaignsApi.new -campaign_id = 'ABC' # String | The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. code = 'code_example' # String | A custom **code** that identifies the voucher. opts = { campaigns_vouchers_create_request_body: VoucherifySdk::CampaignsVouchersCreateRequestBody.new # CampaignsVouchersCreateRequestBody | Specify the voucher parameters that you would like to overwrite. @@ -83,7 +83,7 @@ end ## add_vouchers_to_campaign -> add_vouchers_to_campaign(campaign_id, opts) +> add_vouchers_to_campaign(campaign_id, opts) Add Vouchers to Campaign @@ -133,7 +133,7 @@ end ### Return type -[**CampaignsVouchersCreateResponseBody**](CampaignsVouchersCreateResponseBody.md) +[**CampaignsVouchersCreateCombinedResponseBody**](CampaignsVouchersCreateCombinedResponseBody.md) ### Authorization @@ -173,7 +173,7 @@ end api_instance = VoucherifySdk::CampaignsApi.new opts = { - campaigns_create_request_body: VoucherifySdk::CampaignsCreateDiscountCouponsCampaign.new # CampaignsCreateRequestBody | Specify the details of the campaign that you would like to create. + campaigns_create_request_body: VoucherifySdk::CampaignsCreateRequestBody.new # CampaignsCreateRequestBody | Specify the details of the campaign that you would like to create. } begin @@ -211,7 +211,7 @@ end Delete Campaign -Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. +Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. ### Examples @@ -234,7 +234,7 @@ end api_instance = VoucherifySdk::CampaignsApi.new campaign_id = 'campaign_id_example' # String | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. opts = { - force: true # Boolean | If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name. + force: true # Boolean | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. } begin @@ -251,7 +251,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **campaign_id** | **String** | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | -| **force** | **Boolean** | If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name. | [optional] | +| **force** | **Boolean** | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. | [optional] | ### Return type @@ -269,7 +269,7 @@ end ## disable_campaign -> disable_campaign(campaign_id) +> Object disable_campaign(campaign_id) Disable Campaign @@ -313,7 +313,7 @@ end ### Return type -[**CampaignsDisableResponseBody**](CampaignsDisableResponseBody.md) +**Object** ### Authorization @@ -327,7 +327,7 @@ end ## enable_campaign -> enable_campaign(campaign_id) +> Object enable_campaign(campaign_id) Enable Campaign @@ -371,7 +371,7 @@ end ### Return type -[**CampaignsEnableResponseBody**](CampaignsEnableResponseBody.md) +**Object** ### Authorization @@ -470,7 +470,7 @@ end api_instance = VoucherifySdk::CampaignsApi.new campaign_id = 'campaign_id_example' # String | The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. opts = { - campaigns_import_voucher_item: [VoucherifySdk::CampaignsImportVoucherItem.new({code: 'code_example'})] # Array | Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. + campaigns_import_voucher_item: [VoucherifySdk::CampaignsImportVoucherItem.new] # Array | Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. } begin @@ -505,7 +505,7 @@ end ## import_vouchers_to_campaign_using_csv -> import_vouchers_to_campaign_using_csv(campaign_id, file) +> import_vouchers_to_campaign_using_csv(campaign_id, opts) Import Vouchers to Campaign by CSV @@ -531,11 +531,13 @@ end api_instance = VoucherifySdk::CampaignsApi.new campaign_id = 'campaign_id_example' # String | The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. -file = File.new('/path/to/some/file') # File | File path. +opts = { + file: File.new('/path/to/some/file') # File | File path. +} begin # Import Vouchers to Campaign by CSV - result = api_instance.import_vouchers_to_campaign_using_csv(campaign_id, file) + result = api_instance.import_vouchers_to_campaign_using_csv(campaign_id, opts) p result rescue VoucherifySdk::ApiError => e puts "Error when calling CampaignsApi->import_vouchers_to_campaign_using_csv: #{e}" @@ -547,7 +549,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **campaign_id** | **String** | The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. | | -| **file** | **File** | File path. | | +| **file** | **File** | File path. | [optional] | ### Return type @@ -591,8 +593,8 @@ end api_instance = VoucherifySdk::CampaignsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. campaign_type: VoucherifySdk::ParameterCampaignType::PROMOTION, # ParameterCampaignType | This attribute allows filtering by campaign type. expand: VoucherifySdk::ParameterExpandListCampaigns::CATEGORY, # ParameterExpandListCampaigns | Include an expanded categories object in the response. order: VoucherifySdk::ParameterOrderListCampaigns::CREATED_AT # ParameterOrderListCampaigns | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @@ -611,8 +613,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **campaign_type** | [**ParameterCampaignType**](.md) | This attribute allows filtering by campaign type. | [optional] | | **expand** | [**ParameterExpandListCampaigns**](.md) | Include an expanded categories object in the response. | [optional][default to 'category'] | | **order** | [**ParameterOrderListCampaigns**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | @@ -660,7 +662,7 @@ end api_instance = VoucherifySdk::CampaignsApi.new campaign_id = 'campaign_id_example' # String | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. opts = { - campaigns_update_request_body: VoucherifySdk::CampaignsUpdateDiscountCouponsCampaign.new # CampaignsUpdateRequestBody | Specify the campaign parameters to be updated. + campaigns_update_request_body: VoucherifySdk::CampaignsUpdateRequestBody.new # CampaignsUpdateRequestBody | Specify the campaign parameters to be updated. } begin diff --git a/docs/CampaignsCreateBase.md b/docs/CampaignsCreateBase.md deleted file mode 100644 index 2283022f..00000000 --- a/docs/CampaignsCreateBase.md +++ /dev/null @@ -1,23 +0,0 @@ -# VoucherifySdk::CampaignsCreateBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | - diff --git a/docs/CampaignsCreateDiscountCouponsCampaign.md b/docs/CampaignsCreateDiscountCouponsCampaign.md deleted file mode 100644 index 29793d2a..00000000 --- a/docs/CampaignsCreateDiscountCouponsCampaign.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::CampaignsCreateDiscountCouponsCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional][default to 'DISCOUNT_COUPONS'] | -| **voucher** | [**DiscountCouponsCampaignVoucher**](DiscountCouponsCampaignVoucher.md) | | [optional] | - diff --git a/docs/CampaignsCreateGiftCampaign.md b/docs/CampaignsCreateGiftCampaign.md deleted file mode 100644 index 4a42fdbf..00000000 --- a/docs/CampaignsCreateGiftCampaign.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::CampaignsCreateGiftCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional][default to 'GIFT_VOUCHERS'] | -| **voucher** | [**GiftCampaignVoucher**](GiftCampaignVoucher.md) | | [optional] | - diff --git a/docs/CampaignsCreateGiveawayCampaign.md b/docs/CampaignsCreateGiveawayCampaign.md deleted file mode 100644 index dcf1044b..00000000 --- a/docs/CampaignsCreateGiveawayCampaign.md +++ /dev/null @@ -1,26 +0,0 @@ -# VoucherifySdk::CampaignsCreateGiveawayCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LUCKY_DRAW'] | -| **voucher** | [**GiveawayCampaignVoucher**](GiveawayCampaignVoucher.md) | | [optional] | -| **lucky_draw** | [**LuckyDraw**](LuckyDraw.md) | | [optional] | - diff --git a/docs/CampaignsCreateLoyaltyCampaign.md b/docs/CampaignsCreateLoyaltyCampaign.md deleted file mode 100644 index 6dc58817..00000000 --- a/docs/CampaignsCreateLoyaltyCampaign.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::CampaignsCreateLoyaltyCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LOYALTY_PROGRAM'] | -| **voucher** | [**CampaignLoyaltyVoucher**](CampaignLoyaltyVoucher.md) | | [optional] | - diff --git a/docs/CampaignsCreatePromotionCampaign.md b/docs/CampaignsCreatePromotionCampaign.md deleted file mode 100644 index 8ecd83e2..00000000 --- a/docs/CampaignsCreatePromotionCampaign.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::CampaignsCreatePromotionCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional][default to 'PROMOTION'] | -| **promotion** | [**SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion**](SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion.md) | | [optional] | - diff --git a/docs/CampaignsCreateReferralCampaign.md b/docs/CampaignsCreateReferralCampaign.md deleted file mode 100644 index edfafc48..00000000 --- a/docs/CampaignsCreateReferralCampaign.md +++ /dev/null @@ -1,26 +0,0 @@ -# VoucherifySdk::CampaignsCreateReferralCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Campaign name. | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | -| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional][default to 'REFERRAL_PROGRAM'] | -| **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | -| **voucher** | [**ReferralCampaignVoucher**](ReferralCampaignVoucher.md) | | [optional] | - diff --git a/docs/CampaignsCreateRequestBody.md b/docs/CampaignsCreateRequestBody.md index cde29c35..7aed9882 100644 --- a/docs/CampaignsCreateRequestBody.md +++ b/docs/CampaignsCreateRequestBody.md @@ -1,57 +1,29 @@ # VoucherifySdk::CampaignsCreateRequestBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::CampaignsCreateRequestBody.openapi_one_of -# => -# [ -# :'CampaignsCreateDiscountCouponsCampaign', -# :'CampaignsCreateGiftCampaign', -# :'CampaignsCreateGiveawayCampaign', -# :'CampaignsCreateLoyaltyCampaign', -# :'CampaignsCreatePromotionCampaign', -# :'CampaignsCreateReferralCampaign' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::CampaignsCreateRequestBody.build(data) -# => # - -VoucherifySdk::CampaignsCreateRequestBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `CampaignsCreateDiscountCouponsCampaign` -- `CampaignsCreateGiftCampaign` -- `CampaignsCreateGiveawayCampaign` -- `CampaignsCreateLoyaltyCampaign` -- `CampaignsCreatePromotionCampaign` -- `CampaignsCreateReferralCampaign` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Campaign name. | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | +| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | +| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | +| **metadata** | **Object** | | [optional] | +| **campaign_type** | **String** | | [optional] | +| **voucher** | [**CampaignsCreateRequestBodyVoucher**](CampaignsCreateRequestBodyVoucher.md) | | [optional] | +| **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | +| **promotion** | [**CampaignsCreateRequestBodyPromotion**](CampaignsCreateRequestBodyPromotion.md) | | [optional] | +| **lucky_draw** | [**LuckyDraw**](LuckyDraw.md) | | [optional] | diff --git a/docs/CampaignsCreateRequestBodyPromotion.md b/docs/CampaignsCreateRequestBodyPromotion.md new file mode 100644 index 00000000..26b59fb7 --- /dev/null +++ b/docs/CampaignsCreateRequestBodyPromotion.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CampaignsCreateRequestBodyPromotion + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **tiers** | [**Array<PromotionTierCreateParams>**](PromotionTierCreateParams.md) | | [optional] | + diff --git a/docs/CampaignsCreateRequestBodyVoucher.md b/docs/CampaignsCreateRequestBodyVoucher.md new file mode 100644 index 00000000..f20f9f1e --- /dev/null +++ b/docs/CampaignsCreateRequestBodyVoucher.md @@ -0,0 +1,14 @@ +# VoucherifySdk::CampaignsCreateRequestBodyVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | +| **redemption** | [**CampaignsCreateRequestBodyVoucherRedemption**](CampaignsCreateRequestBodyVoucherRedemption.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **gift** | [**Gift**](Gift.md) | | [optional] | +| **loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] | + diff --git a/docs/CampaignsCreateRequestBodyVoucherRedemption.md b/docs/CampaignsCreateRequestBodyVoucherRedemption.md new file mode 100644 index 00000000..2150bd05 --- /dev/null +++ b/docs/CampaignsCreateRequestBodyVoucherRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CampaignsCreateRequestBodyVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | + diff --git a/docs/CampaignsCreateResponseBody.md b/docs/CampaignsCreateResponseBody.md index 63a39cf6..fc316ed0 100644 --- a/docs/CampaignsCreateResponseBody.md +++ b/docs/CampaignsCreateResponseBody.md @@ -4,34 +4,36 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **name** | **String** | Campaign name. | | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | | **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **campaign_type** | **String** | Type of campaign. | | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | | +| **campaign_type** | **String** | Type of campaign. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | | **voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | | **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | | **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | | **category** | **String** | Unique category name. | [optional] | -| **creation_status** | **String** | Indicates the status of the campaign creation. | | -| **vouchers_generation_status** | **String** | Indicates the status of the campaign's vouchers. | | -| **protected** | **Boolean** | Indicates whether the resource can be deleted. | | -| **category_id** | **String** | Unique category ID that this campaign belongs to. | | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the campaign. | [default to 'campaign'] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | | **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | | **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | | **promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | diff --git a/docs/CampaignsDisableResponseBody.md b/docs/CampaignsDisableResponseBody.md deleted file mode 100644 index 838e4d01..00000000 --- a/docs/CampaignsDisableResponseBody.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::CampaignsDisableResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/CampaignsEnableResponseBody.md b/docs/CampaignsEnableResponseBody.md deleted file mode 100644 index fad4cc3d..00000000 --- a/docs/CampaignsEnableResponseBody.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::CampaignsEnableResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/CampaignsGetResponseBody.md b/docs/CampaignsGetResponseBody.md index c47fa852..ed3d90ab 100644 --- a/docs/CampaignsGetResponseBody.md +++ b/docs/CampaignsGetResponseBody.md @@ -4,34 +4,36 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **name** | **String** | Campaign name. | | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | | **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **campaign_type** | **String** | Type of campaign. | | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | | +| **campaign_type** | **String** | Type of campaign. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | | **voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | | **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | | **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | | **category** | **String** | Unique category name. | [optional] | -| **creation_status** | **String** | Indicates the status of the campaign creation. | | -| **vouchers_generation_status** | **String** | Indicates the status of the campaign's vouchers. | | -| **protected** | **Boolean** | Indicates whether the resource can be deleted. | | -| **category_id** | **String** | Unique category ID that this campaign belongs to. | | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the campaign. | [default to 'campaign'] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | | **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | | **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | | **promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | diff --git a/docs/CampaignsImportCreateResponseBody.md b/docs/CampaignsImportCreateResponseBody.md index ee03dad6..3ff82a49 100644 --- a/docs/CampaignsImportCreateResponseBody.md +++ b/docs/CampaignsImportCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/CampaignsImportCsvCreateResponseBody.md b/docs/CampaignsImportCsvCreateResponseBody.md index 0e56a97b..c59d710c 100644 --- a/docs/CampaignsImportCsvCreateResponseBody.md +++ b/docs/CampaignsImportCsvCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/CampaignsImportVoucherItem.md b/docs/CampaignsImportVoucherItem.md index fcc467d0..a33c547e 100644 --- a/docs/CampaignsImportVoucherItem.md +++ b/docs/CampaignsImportVoucherItem.md @@ -4,17 +4,18 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **String** | Unique custom voucher code. | | -| **type** | **String** | Type of voucher. | [optional] | +| **code** | **String** | Value representing the imported code. | [optional] | | **redemption** | [**CampaignsImportVoucherItemRedemption**](CampaignsImportVoucherItemRedemption.md) | | [optional] | | **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **metadata** | **Object** | | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. | [optional] | +| **start_date** | **Time** | Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] | +| **expiration_date** | **Time** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | -| **discount** | [**Discount**](Discount.md) | | [optional] | +| **type** | **String** | | [optional] | +| **loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] | | **gift** | [**Gift**](Gift.md) | | [optional] | -| **loyalty_card** | [**CampaignsImportVoucherLoyaltyCard**](CampaignsImportVoucherLoyaltyCard.md) | | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | diff --git a/docs/CampaignsImportVoucherLoyaltyCard.md b/docs/CampaignsImportVoucherLoyaltyCard.md deleted file mode 100644 index 0da00fcb..00000000 --- a/docs/CampaignsImportVoucherLoyaltyCard.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::CampaignsImportVoucherLoyaltyCard - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **points** | **Integer** | The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. | | - diff --git a/docs/CampaignsListResponseBody.md b/docs/CampaignsListResponseBody.md index bfd0d12c..de7ec35b 100644 --- a/docs/CampaignsListResponseBody.md +++ b/docs/CampaignsListResponseBody.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about campaigns in a dictionary. | [optional][default to 'list'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about campaigns in a dictionary. | [optional][default to 'list'] | | **data_ref** | **String** | Identifies the name of the attribute that contains the array of campaign objects. | [optional][default to 'campaigns'] | | **campaigns** | [**Array<CampaignBase>**](CampaignBase.md) | Contains array of campaign objects. | [optional] | | **total** | **Integer** | Total number of campaigns. | [optional] | diff --git a/docs/CampaignsUpdateBase.md b/docs/CampaignsUpdateBase.md deleted file mode 100644 index d976fec0..00000000 --- a/docs/CampaignsUpdateBase.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::CampaignsUpdateBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | - diff --git a/docs/CampaignsUpdateCouponCampaignBase.md b/docs/CampaignsUpdateCouponCampaignBase.md deleted file mode 100644 index 74b31cc6..00000000 --- a/docs/CampaignsUpdateCouponCampaignBase.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::CampaignsUpdateCouponCampaignBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | - diff --git a/docs/CampaignsUpdateDiscountCouponsCampaign.md b/docs/CampaignsUpdateDiscountCouponsCampaign.md deleted file mode 100644 index a0ebf728..00000000 --- a/docs/CampaignsUpdateDiscountCouponsCampaign.md +++ /dev/null @@ -1,21 +0,0 @@ -# VoucherifySdk::CampaignsUpdateDiscountCouponsCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **discount** | [**Discount**](Discount.md) | | [optional] | - diff --git a/docs/CampaignsUpdateGiftCampaign.md b/docs/CampaignsUpdateGiftCampaign.md deleted file mode 100644 index 4f246621..00000000 --- a/docs/CampaignsUpdateGiftCampaign.md +++ /dev/null @@ -1,21 +0,0 @@ -# VoucherifySdk::CampaignsUpdateGiftCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **gift** | [**Gift**](Gift.md) | | [optional] | - diff --git a/docs/CampaignsUpdateGiveawayCampaign.md b/docs/CampaignsUpdateGiveawayCampaign.md deleted file mode 100644 index eed0c26d..00000000 --- a/docs/CampaignsUpdateGiveawayCampaign.md +++ /dev/null @@ -1,23 +0,0 @@ -# VoucherifySdk::CampaignsUpdateGiveawayCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **winners_count** | **String** | It represents the total number of winners in a lucky draw. | [optional] | -| **unique_winners_per_draw** | **String** | It indicates whether each winner in a draw is unique or not. | [optional] | -| **unique_winners** | **String** | Specifies whether each participant can win only once across multiple draws. | [optional] | - diff --git a/docs/CampaignsUpdateLoyaltyCampaign.md b/docs/CampaignsUpdateLoyaltyCampaign.md deleted file mode 100644 index d007340c..00000000 --- a/docs/CampaignsUpdateLoyaltyCampaign.md +++ /dev/null @@ -1,22 +0,0 @@ -# VoucherifySdk::CampaignsUpdateLoyaltyCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | -| **options** | [**PropertiesForLoyaltyCampaignOptions**](PropertiesForLoyaltyCampaignOptions.md) | | [optional] | - diff --git a/docs/CampaignsUpdatePromotionCampaign.md b/docs/CampaignsUpdatePromotionCampaign.md deleted file mode 100644 index 7b44ad33..00000000 --- a/docs/CampaignsUpdatePromotionCampaign.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::CampaignsUpdatePromotionCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | - diff --git a/docs/CampaignsUpdateReferralCampaign.md b/docs/CampaignsUpdateReferralCampaign.md deleted file mode 100644 index ee359069..00000000 --- a/docs/CampaignsUpdateReferralCampaign.md +++ /dev/null @@ -1,22 +0,0 @@ -# VoucherifySdk::CampaignsUpdateReferralCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | -| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **discount** | [**Discount**](Discount.md) | | [optional] | -| **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | - diff --git a/docs/CampaignsUpdateRequestBody.md b/docs/CampaignsUpdateRequestBody.md index c0b4dd33..cd89b6a6 100644 --- a/docs/CampaignsUpdateRequestBody.md +++ b/docs/CampaignsUpdateRequestBody.md @@ -1,57 +1,29 @@ # VoucherifySdk::CampaignsUpdateRequestBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::CampaignsUpdateRequestBody.openapi_one_of -# => -# [ -# :'CampaignsUpdateDiscountCouponsCampaign', -# :'CampaignsUpdateGiftCampaign', -# :'CampaignsUpdateGiveawayCampaign', -# :'CampaignsUpdateLoyaltyCampaign', -# :'CampaignsUpdatePromotionCampaign', -# :'CampaignsUpdateReferralCampaign' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::CampaignsUpdateRequestBody.build(data) -# => # - -VoucherifySdk::CampaignsUpdateRequestBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `CampaignsUpdateDiscountCouponsCampaign` -- `CampaignsUpdateGiftCampaign` -- `CampaignsUpdateGiveawayCampaign` -- `CampaignsUpdateLoyaltyCampaign` -- `CampaignsUpdatePromotionCampaign` -- `CampaignsUpdateReferralCampaign` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | +| **metadata** | **Object** | | [optional] | +| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | +| **discount** | **Object** | | [optional] | +| **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | +| **gift** | [**Gift**](Gift.md) | | [optional] | +| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | +| **options** | [**CampaignsUpdateRequestBodyOptions**](CampaignsUpdateRequestBodyOptions.md) | | [optional] | +| **winners_count** | **String** | It represents the total number of winners in a lucky draw. | [optional] | +| **unique_winners_per_draw** | **String** | It indicates whether each winner in a draw is unique or not. | [optional] | +| **unique_winners** | **String** | Specifies whether each participant can win only once across multiple draws. | [optional] | diff --git a/docs/CampaignsUpdateRequestBodyOptions.md b/docs/CampaignsUpdateRequestBodyOptions.md new file mode 100644 index 00000000..a3a2eb6b --- /dev/null +++ b/docs/CampaignsUpdateRequestBodyOptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CampaignsUpdateRequestBodyOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **recalculate_tiers** | **Boolean** | Determine if tiers should be recalculated or no. | [optional] | + diff --git a/docs/CampaignsUpdateResponseBody.md b/docs/CampaignsUpdateResponseBody.md index ec7b10a8..9525e079 100644 --- a/docs/CampaignsUpdateResponseBody.md +++ b/docs/CampaignsUpdateResponseBody.md @@ -4,34 +4,36 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **name** | **String** | Campaign name. | | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | | **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | -| **campaign_type** | **String** | Type of campaign. | | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | | +| **campaign_type** | **String** | Type of campaign. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | | **voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | | -| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | | -| **validity_timeframe** | [**CampaignBaseValidityTimeframe**](CampaignBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | | **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | | **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | | **category** | **String** | Unique category name. | [optional] | -| **creation_status** | **String** | Indicates the status of the campaign creation. | | -| **vouchers_generation_status** | **String** | Indicates the status of the campaign's vouchers. | | -| **protected** | **Boolean** | Indicates whether the resource can be deleted. | | -| **category_id** | **String** | Unique category ID that this campaign belongs to. | | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the campaign. | [default to 'campaign'] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | | **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | | **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | | **promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | diff --git a/docs/CampaignsVouchersCreateBaseRequestBody.md b/docs/CampaignsVouchersCreateBaseRequestBody.md deleted file mode 100644 index 7b1a17dd..00000000 --- a/docs/CampaignsVouchersCreateBaseRequestBody.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::CampaignsVouchersCreateBaseRequestBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | -| **redemption** | [**CampaignsImportVoucherItemRedemption**](CampaignsImportVoucherItemRedemption.md) | | [optional] | -| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | - diff --git a/docs/CampaignsVouchersCreateCombinedResponseBody.md b/docs/CampaignsVouchersCreateCombinedResponseBody.md new file mode 100644 index 00000000..33a5022d --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBody.md @@ -0,0 +1,37 @@ +# VoucherifySdk::CampaignsVouchersCreateCombinedResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**CampaignsVouchersCreateCombinedResponseBodyGift**](CampaignsVouchersCreateCombinedResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard**](CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**CampaignsVouchersCreateCombinedResponseBodyPublish**](CampaignsVouchersCreateCombinedResponseBodyPublish.md) | | [optional] | +| **redemption** | [**CampaignsVouchersCreateCombinedResponseBodyRedemption**](CampaignsVouchersCreateCombinedResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | + diff --git a/docs/CampaignsVouchersCreateCombinedResponseBodyGift.md b/docs/CampaignsVouchersCreateCombinedResponseBodyGift.md new file mode 100644 index 00000000..a8228b5f --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md b/docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..425b6e93 --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md b/docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md new file mode 100644 index 00000000..f5869e7d --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md b/docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md new file mode 100644 index 00000000..4b4b0760 --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::CampaignsVouchersCreateCombinedResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/CampaignsVouchersCreateInBulkRequestBody.md b/docs/CampaignsVouchersCreateInBulkRequestBody.md index 30004237..5f3d3969 100644 --- a/docs/CampaignsVouchersCreateInBulkRequestBody.md +++ b/docs/CampaignsVouchersCreateInBulkRequestBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **code** | **String** | Unique voucher code. | [optional] | +| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | | **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | -| **redemption** | [**CampaignsImportVoucherItemRedemption**](CampaignsImportVoucherItemRedemption.md) | | [optional] | +| **redemption** | [**CampaignsVouchersCreateInBulkRequestBodyRedemption**](CampaignsVouchersCreateInBulkRequestBodyRedemption.md) | | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **code** | **String** | Unique voucher code. | [optional] | -| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | diff --git a/docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md b/docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md new file mode 100644 index 00000000..5bd793f2 --- /dev/null +++ b/docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CampaignsVouchersCreateInBulkRequestBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | + diff --git a/docs/CampaignsVouchersCreateInBulkResponseBody.md b/docs/CampaignsVouchersCreateInBulkResponseBody.md deleted file mode 100644 index 9a3edac1..00000000 --- a/docs/CampaignsVouchersCreateInBulkResponseBody.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::CampaignsVouchersCreateInBulkResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | - diff --git a/docs/CampaignsVouchersCreateRequestBody.md b/docs/CampaignsVouchersCreateRequestBody.md index 7bcbf42b..7aaf767f 100644 --- a/docs/CampaignsVouchersCreateRequestBody.md +++ b/docs/CampaignsVouchersCreateRequestBody.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | -| **redemption** | [**CampaignsImportVoucherItemRedemption**](CampaignsImportVoucherItemRedemption.md) | | [optional] | +| **redemption** | [**CampaignsVouchersCreateRequestBodyRedemption**](CampaignsVouchersCreateRequestBodyRedemption.md) | | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | diff --git a/docs/CampaignsVouchersCreateRequestBodyRedemption.md b/docs/CampaignsVouchersCreateRequestBodyRedemption.md new file mode 100644 index 00000000..4ae2c0fb --- /dev/null +++ b/docs/CampaignsVouchersCreateRequestBodyRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CampaignsVouchersCreateRequestBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | + diff --git a/docs/CampaignsVouchersCreateResponseBody.md b/docs/CampaignsVouchersCreateResponseBody.md index 65675733..341ca513 100644 --- a/docs/CampaignsVouchersCreateResponseBody.md +++ b/docs/CampaignsVouchersCreateResponseBody.md @@ -10,28 +10,27 @@ | **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | | **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | | **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **type** | **String** | Defines the type of the voucher. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | -| **gift** | [**VoucherGift**](VoucherGift.md) | | [optional] | -| **loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] | +| **gift** | [**CampaignsVouchersCreateResponseBodyGift**](CampaignsVouchersCreateResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**CampaignsVouchersCreateResponseBodyLoyaltyCard**](CampaignsVouchersCreateResponseBodyLoyaltyCard.md) | | [optional] | | **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**VoucherValidityTimeframe**](VoucherValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | | **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | | **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | -| **distributions** | **Array<Object>** | | [optional] | -| **deleted** | **Boolean** | Flag indicating whether this voucher is deleted. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**CampaignsVouchersCreateResponseBodyPublish**](CampaignsVouchersCreateResponseBodyPublish.md) | | [optional] | +| **redemption** | [**CampaignsVouchersCreateResponseBodyRedemption**](CampaignsVouchersCreateResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | -| **publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] | -| **redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] | diff --git a/docs/CampaignsVouchersCreateResponseBodyGift.md b/docs/CampaignsVouchersCreateResponseBodyGift.md new file mode 100644 index 00000000..c8ae3857 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::CampaignsVouchersCreateResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md b/docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..3d81d39c --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::CampaignsVouchersCreateResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/CampaignsVouchersCreateResponseBodyPublish.md b/docs/CampaignsVouchersCreateResponseBodyPublish.md new file mode 100644 index 00000000..452f44f1 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::CampaignsVouchersCreateResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/CampaignsVouchersCreateResponseBodyRedemption.md b/docs/CampaignsVouchersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..5fe15cb5 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::CampaignsVouchersCreateResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/CategoriesApi.md b/docs/CategoriesApi.md index 84bf5153..52307851 100644 --- a/docs/CategoriesApi.md +++ b/docs/CategoriesApi.md @@ -39,7 +39,7 @@ end api_instance = VoucherifySdk::CategoriesApi.new opts = { - categories_create_request_body: VoucherifySdk::CategoriesCreateRequestBody.new({name: 'name_example', hierarchy: 37}) # CategoriesCreateRequestBody | Specify the details of the category that you would like to create. + categories_create_request_body: VoucherifySdk::CategoriesCreateRequestBody.new # CategoriesCreateRequestBody | Specify the details of the category that you would like to create. } begin @@ -270,7 +270,7 @@ end api_instance = VoucherifySdk::CategoriesApi.new category_id = 'category_id_example' # String | Unique category ID assigned by Voucherify. opts = { - categories_update_request_body: VoucherifySdk::CategoriesUpdateRequestBody.new({name: 'name_example', hierarchy: 37}) # CategoriesUpdateRequestBody | Specify the details of the category that you would like to update. + categories_update_request_body: VoucherifySdk::CategoriesUpdateRequestBody.new # CategoriesUpdateRequestBody | Specify the details of the category that you would like to update. } begin diff --git a/docs/CategoriesCreateRequestBody.md b/docs/CategoriesCreateRequestBody.md index 319f0f99..3119575c 100644 --- a/docs/CategoriesCreateRequestBody.md +++ b/docs/CategoriesCreateRequestBody.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Category name. | | -| **hierarchy** | **Integer** | Category hierarchy. | | +| **name** | **String** | Category name. | [optional] | +| **hierarchy** | **Integer** | Category hierarchy. | [optional] | diff --git a/docs/CategoriesCreateResponseBody.md b/docs/CategoriesCreateResponseBody.md index 31fedbac..01d1db2d 100644 --- a/docs/CategoriesCreateResponseBody.md +++ b/docs/CategoriesCreateResponseBody.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique category ID assigned by Voucherify. | | -| **name** | **String** | Category name. | | -| **hierarchy** | **Integer** | Category hierarchy. | | -| **object** | **String** | | [default to 'category'] | -| **created_at** | **Time** | Timestamp representing the date and time when the category was created in ISO 8601 format. | | +| **id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **name** | **String** | Category name. | [optional] | +| **hierarchy** | **Integer** | Category hierarchy. | [optional] | +| **object** | **String** | | [optional][default to 'category'] | +| **created_at** | **Time** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/CategoriesGetResponseBody.md b/docs/CategoriesGetResponseBody.md index ce0f7bd0..1c08fd04 100644 --- a/docs/CategoriesGetResponseBody.md +++ b/docs/CategoriesGetResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique category ID assigned by Voucherify. | | -| **name** | **String** | Category name. | | -| **hierarchy** | **Integer** | Category hierarchy. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the category. | [default to 'category'] | -| **created_at** | **Time** | Timestamp representing the date and time when the category was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the category was updated in ISO 8601 format. | [optional] | +| **id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **name** | **String** | Category name. | [optional] | +| **hierarchy** | **Integer** | Category hierarchy. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the category. | [optional][default to 'category'] | +| **created_at** | **Time** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] | | **stacking_rules_type** | **String** | The type of the stacking rule eligibility. | [optional] | diff --git a/docs/CategoriesListResponseBody.md b/docs/CategoriesListResponseBody.md index 6d67155c..93357a0e 100644 --- a/docs/CategoriesListResponseBody.md +++ b/docs/CategoriesListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about categories in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of category objects. | [default to 'data'] | -| **data** | [**Array<Category>**](Category.md) | | | -| **total** | **Integer** | Total number of categories. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about categories in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of category objects. | [optional][default to 'data'] | +| **data** | [**Array<Category>**](Category.md) | | [optional] | +| **total** | **Integer** | Total number of categories. | [optional] | diff --git a/docs/CategoriesUpdateRequestBody.md b/docs/CategoriesUpdateRequestBody.md index efa3979a..ff3588b2 100644 --- a/docs/CategoriesUpdateRequestBody.md +++ b/docs/CategoriesUpdateRequestBody.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Category name. | | -| **hierarchy** | **Integer** | Category hierarchy. | | +| **name** | **String** | Category name. | [optional] | +| **hierarchy** | **Integer** | Category hierarchy. | [optional] | diff --git a/docs/CategoriesUpdateResponseBody.md b/docs/CategoriesUpdateResponseBody.md index 584c84e9..56340a9a 100644 --- a/docs/CategoriesUpdateResponseBody.md +++ b/docs/CategoriesUpdateResponseBody.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique category ID assigned by Voucherify. | | -| **name** | **String** | Category name. | | -| **hierarchy** | **Integer** | Category hierarchy. | | -| **object** | **String** | | [default to 'category'] | -| **created_at** | **Time** | Timestamp representing the date and time when the category was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the category was updated in ISO 8601 format. | | +| **id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **name** | **String** | Category name. | [optional] | +| **hierarchy** | **Integer** | Category hierarchy. | [optional] | +| **object** | **String** | | [optional][default to 'category'] | +| **created_at** | **Time** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/Category.md b/docs/Category.md index 2363e4b0..a93fb253 100644 --- a/docs/Category.md +++ b/docs/Category.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique category ID assigned by Voucherify. | | -| **name** | **String** | Category name. | | -| **hierarchy** | **Integer** | Category hierarchy. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the category. | [default to 'category'] | -| **created_at** | **Time** | Timestamp representing the date and time when the category was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the category was updated in ISO 8601 format. | [optional] | +| **id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **name** | **String** | Category name. | [optional] | +| **hierarchy** | **Integer** | Category hierarchy. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the category. | [optional][default to 'category'] | +| **created_at** | **Time** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] | | **stacking_rules_type** | **String** | The type of the stacking rule eligibility. | [optional] | diff --git a/docs/ClientEventsCreateRequestBody.md b/docs/ClientEventsCreateRequestBody.md index 6ab123e5..f32063b7 100644 --- a/docs/ClientEventsCreateRequestBody.md +++ b/docs/ClientEventsCreateRequestBody.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **event** | **String** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | | +| **event** | **String** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | [optional] | | **customer** | [**Customer**](Customer.md) | | | | **referral** | [**ClientEventsCreateRequestBodyReferral**](ClientEventsCreateRequestBodyReferral.md) | | [optional] | | **loyalty** | [**ClientEventsCreateRequestBodyLoyalty**](ClientEventsCreateRequestBodyLoyalty.md) | | [optional] | diff --git a/docs/ClientEventsCreateRequestBodyLoyalty.md b/docs/ClientEventsCreateRequestBodyLoyalty.md index 02eedd55..459bf419 100644 --- a/docs/ClientEventsCreateRequestBodyLoyalty.md +++ b/docs/ClientEventsCreateRequestBodyLoyalty.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **String** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | | +| **code** | **String** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | [optional] | diff --git a/docs/ClientEventsCreateRequestBodyReferral.md b/docs/ClientEventsCreateRequestBodyReferral.md index 7ff8ffe6..88314a81 100644 --- a/docs/ClientEventsCreateRequestBodyReferral.md +++ b/docs/ClientEventsCreateRequestBodyReferral.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **String** | A code through which a new visitor has been referred to a service. | | +| **code** | **String** | A code through which a new visitor has been referred to a service. | [optional] | | **referrer_id** | **String** | Unique ID of the referring person - it is optional and not required if the referral **code** is provided. | [optional] | diff --git a/docs/ClientEventsCreateResponseBody.md b/docs/ClientEventsCreateResponseBody.md index 3629c2f5..c727fc3a 100644 --- a/docs/ClientEventsCreateResponseBody.md +++ b/docs/ClientEventsCreateResponseBody.md @@ -4,9 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The object represented is an `event`. | [default to 'event'] | -| **type** | **String** | The event name. | | +| **object** | **String** | The object represented is an `event`. | [optional][default to 'event'] | +| **type** | **String** | The event name. | [optional] | | **customer** | [**SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | | -| **referral** | **Object** | A `null` referral object. | | -| **loyalty** | **Object** | A `null` loyalty object. | | +| **referral** | **Object** | A `null` referral object. | [optional] | +| **loyalty** | **Object** | A `null` loyalty object. | [optional] | +| **metadata** | **Object** | | [optional] | diff --git a/docs/ClientPromotionsTiersListResponseBody.md b/docs/ClientPromotionsTiersListResponseBody.md new file mode 100644 index 00000000..9ed942c2 --- /dev/null +++ b/docs/ClientPromotionsTiersListResponseBody.md @@ -0,0 +1,12 @@ +# VoucherifySdk::ClientPromotionsTiersListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional][default to 'tiers'] | +| **tiers** | [**Array<PromotionTier>**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] | +| **total** | **Integer** | Total number of promotion tiers. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | + diff --git a/docs/ClientQualificationsCheckEligibilityRequestBody.md b/docs/ClientQualificationsCheckEligibilityRequestBody.md index d6e6f1bc..d3e91c90 100644 --- a/docs/ClientQualificationsCheckEligibilityRequestBody.md +++ b/docs/ClientQualificationsCheckEligibilityRequestBody.md @@ -6,9 +6,8 @@ | ---- | ---- | ----------- | ----- | | **customer** | [**Customer**](Customer.md) | | [optional] | | **order** | [**Order**](Order.md) | | [optional] | -| **mode** | **String** | Defines which resources Voucherify will use. The `ADVANCED` mode is available after purchase only. | [optional] | | **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | -| **scenario** | **String** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] | +| **scenario** | **String** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] | | **options** | [**QualificationsOption**](QualificationsOption.md) | | [optional] | | **metadata** | **Object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] | diff --git a/docs/ClientQualificationsCheckEligibilityRequestBodyOptions.md b/docs/ClientQualificationsCheckEligibilityRequestBodyOptions.md deleted file mode 100644 index 671a8296..00000000 --- a/docs/ClientQualificationsCheckEligibilityRequestBodyOptions.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::ClientQualificationsCheckEligibilityRequestBodyOptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5 | [optional] | -| **starting_after** | **Time** | Cursor used for paging. | [optional] | -| **filters** | [**ClientQualificationsCheckEligibilityRequestBodyOptionsFilters**](ClientQualificationsCheckEligibilityRequestBodyOptionsFilters.md) | | [optional] | -| **expand** | **Array<String>** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. | | [optional] | -| **sorting_rule** | **String** | Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount` | [optional] | - diff --git a/docs/ClientQualificationsCheckEligibilityRequestBodyOptionsFilters.md b/docs/ClientQualificationsCheckEligibilityRequestBodyOptionsFilters.md deleted file mode 100644 index 5e60b5a8..00000000 --- a/docs/ClientQualificationsCheckEligibilityRequestBodyOptionsFilters.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::ClientQualificationsCheckEligibilityRequestBodyOptionsFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **category_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | -| **campaign_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | -| **resource_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | -| **resource_type** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | -| **voucher_type** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | -| **code** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | - diff --git a/docs/ClientRedemptionsRedeemRequestBody.md b/docs/ClientRedemptionsRedeemRequestBody.md index 5cdc25b3..90edb71d 100644 --- a/docs/ClientRedemptionsRedeemRequestBody.md +++ b/docs/ClientRedemptionsRedeemRequestBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemables** | [**Array<StackableValidateRedeemBaseRedeemablesItem>**](StackableValidateRedeemBaseRedeemablesItem.md) | An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. | | +| **options** | [**ClientRedemptionsRedeemRequestBodyOptions**](ClientRedemptionsRedeemRequestBodyOptions.md) | | [optional] | +| **redeemables** | [**Array<ClientRedemptionsRedeemRequestBodyRedeemablesItem>**](ClientRedemptionsRedeemRequestBodyRedeemablesItem.md) | | [optional] | | **order** | [**Order**](Order.md) | | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | | **session** | [**Session**](Session.md) | | [optional] | | **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | | **metadata** | **Object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] | -| **options** | [**ClientRedemptionsRedeemRequestBodyAllOfOptions**](ClientRedemptionsRedeemRequestBodyAllOfOptions.md) | | [optional] | diff --git a/docs/ClientRedemptionsRedeemRequestBodyAllOfOptions.md b/docs/ClientRedemptionsRedeemRequestBodyAllOfOptions.md deleted file mode 100644 index 980f60d6..00000000 --- a/docs/ClientRedemptionsRedeemRequestBodyAllOfOptions.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::ClientRedemptionsRedeemRequestBodyAllOfOptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **expand** | **Array<String>** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] | - diff --git a/docs/ClientRedemptionsRedeemRequestBodyOptions.md b/docs/ClientRedemptionsRedeemRequestBodyOptions.md new file mode 100644 index 00000000..a31e3647 --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyOptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ClientRedemptionsRedeemRequestBodyOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expand** | **Array<String>** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] | + diff --git a/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..b2d69c5c --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ClientRedemptionsRedeemRequestBodyRedeemablesItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | +| **id** | **String** | | [optional] | +| **gift** | [**ClientRedemptionsRedeemRequestBodyRedeemablesItemGift**](ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md) | | [optional] | +| **reward** | [**ClientRedemptionsRedeemRequestBodyRedeemablesItemReward**](ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md) | | [optional] | + diff --git a/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..d6fa4939 --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ClientRedemptionsRedeemRequestBodyRedeemablesItemGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **credits** | **Integer** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | + diff --git a/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..e3cbd96c --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ClientRedemptionsRedeemRequestBodyRedeemablesItemReward + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] | +| **points** | **Integer** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] | + diff --git a/docs/ClientSideApi.md b/docs/ClientSideApi.md index 15820557..d273f94a 100644 --- a/docs/ClientSideApi.md +++ b/docs/ClientSideApi.md @@ -5,9 +5,9 @@ All URIs are relative to *https://api.voucherify.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**check_eligibility_client_side**](ClientSideApi.md#check_eligibility_client_side) | **POST** /client/v1/qualifications | Check Eligibility (client-side) | +| [**list_promotion_tiers_client_side**](ClientSideApi.md#list_promotion_tiers_client_side) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (client-side) | | [**redeem_stacked_discounts_client_side**](ClientSideApi.md#redeem_stacked_discounts_client_side) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) | | [**track_custom_event_client_side**](ClientSideApi.md#track_custom_event_client_side) | **POST** /client/v1/events | Track Custom Event (client-side) | -| [**update_customers_consents_client_side**](ClientSideApi.md#update_customers_consents_client_side) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) | | [**validate_stacked_discounts_client_side**](ClientSideApi.md#validate_stacked_discounts_client_side) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) | @@ -71,13 +71,13 @@ end - **Accept**: application/json -## redeem_stacked_discounts_client_side +## list_promotion_tiers_client_side -> redeem_stacked_discounts_client_side(origin, opts) +> list_promotion_tiers_client_side(origin, opts) -Redeem Stackable Discounts (client-side) +List Promotion Tiers (client-side) -This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. +This method enables you to list promotion tiers. ### Examples @@ -100,15 +100,18 @@ end api_instance = VoucherifySdk::ClientSideApi.new origin = 'origin_example' # String | Indicates the origin (scheme, hostname, and port). opts = { - client_redemptions_redeem_request_body: VoucherifySdk::ClientRedemptionsRedeemRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # ClientRedemptionsRedeemRequestBody | + is_available: true, # Boolean | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + order: VoucherifySdk::ParameterOrderListPromotionTiersClientSide::CREATED_AT # ParameterOrderListPromotionTiersClientSide | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. } begin - # Redeem Stackable Discounts (client-side) - result = api_instance.redeem_stacked_discounts_client_side(origin, opts) + # List Promotion Tiers (client-side) + result = api_instance.list_promotion_tiers_client_side(origin, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling ClientSideApi->redeem_stacked_discounts_client_side: #{e}" + puts "Error when calling ClientSideApi->list_promotion_tiers_client_side: #{e}" end ``` @@ -117,11 +120,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **origin** | **String** | Indicates the origin (scheme, hostname, and port). | | -| **client_redemptions_redeem_request_body** | [**ClientRedemptionsRedeemRequestBody**](ClientRedemptionsRedeemRequestBody.md) | | [optional] | +| **is_available** | **Boolean** | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListPromotionTiersClientSide**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type -[**ClientRedemptionsRedeemResponseBody**](ClientRedemptionsRedeemResponseBody.md) +[**ClientPromotionsTiersListResponseBody**](ClientPromotionsTiersListResponseBody.md) ### Authorization @@ -129,17 +135,17 @@ end ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json -## track_custom_event_client_side +## redeem_stacked_discounts_client_side -> track_custom_event_client_side(origin, opts) +> redeem_stacked_discounts_client_side(origin, opts) -Track Custom Event (client-side) +Redeem Stackable Discounts (client-side) -To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. +This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. ### Examples @@ -162,15 +168,15 @@ end api_instance = VoucherifySdk::ClientSideApi.new origin = 'origin_example' # String | Indicates the origin (scheme, hostname, and port). opts = { - client_events_create_request_body: VoucherifySdk::ClientEventsCreateRequestBody.new({event: 'event_example', customer: VoucherifySdk::Customer.new}) # ClientEventsCreateRequestBody | Specify the details of the custom event. + client_redemptions_redeem_request_body: VoucherifySdk::ClientRedemptionsRedeemRequestBody.new # ClientRedemptionsRedeemRequestBody | } begin - # Track Custom Event (client-side) - result = api_instance.track_custom_event_client_side(origin, opts) + # Redeem Stackable Discounts (client-side) + result = api_instance.redeem_stacked_discounts_client_side(origin, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling ClientSideApi->track_custom_event_client_side: #{e}" + puts "Error when calling ClientSideApi->redeem_stacked_discounts_client_side: #{e}" end ``` @@ -179,11 +185,11 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **origin** | **String** | Indicates the origin (scheme, hostname, and port). | | -| **client_events_create_request_body** | [**ClientEventsCreateRequestBody**](ClientEventsCreateRequestBody.md) | Specify the details of the custom event. | [optional] | +| **client_redemptions_redeem_request_body** | [**ClientRedemptionsRedeemRequestBody**](ClientRedemptionsRedeemRequestBody.md) | | [optional] | ### Return type -[**ClientEventsCreateResponseBody**](ClientEventsCreateResponseBody.md) +[**ClientRedemptionsRedeemResponseBody**](ClientRedemptionsRedeemResponseBody.md) ### Authorization @@ -195,13 +201,13 @@ end - **Accept**: application/json -## update_customers_consents_client_side +## track_custom_event_client_side -> update_customers_consents_client_side(customer_id, opts) +> track_custom_event_client_side(origin, opts) -Update Customer's consents (client-side) +Track Custom Event (client-side) -Update marketing permissions for the specified customer. +To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. ### Examples @@ -222,16 +228,17 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::ClientSideApi.new -customer_id = 'customer_id_example' # String | A Voucherify customer identifier or source_id +origin = 'origin_example' # String | Indicates the origin (scheme, hostname, and port). opts = { - body: { ... } # Object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: + client_events_create_request_body: VoucherifySdk::ClientEventsCreateRequestBody.new({customer: VoucherifySdk::Customer.new}) # ClientEventsCreateRequestBody | Specify the details of the custom event. } begin - # Update Customer's consents (client-side) - api_instance.update_customers_consents_client_side(customer_id, opts) + # Track Custom Event (client-side) + result = api_instance.track_custom_event_client_side(origin, opts) + p result rescue VoucherifySdk::ApiError => e - puts "Error when calling ClientSideApi->update_customers_consents_client_side: #{e}" + puts "Error when calling ClientSideApi->track_custom_event_client_side: #{e}" end ``` @@ -239,12 +246,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customer_id** | **String** | A Voucherify customer identifier or source_id | | -| **body** | **Object** | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: | [optional] | +| **origin** | **String** | Indicates the origin (scheme, hostname, and port). | | +| **client_events_create_request_body** | [**ClientEventsCreateRequestBody**](ClientEventsCreateRequestBody.md) | Specify the details of the custom event. | [optional] | ### Return type -nil (empty response body) +[**ClientEventsCreateResponseBody**](ClientEventsCreateResponseBody.md) ### Authorization @@ -253,7 +260,7 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: application/json -- **Accept**: Not defined +- **Accept**: application/json ## validate_stacked_discounts_client_side @@ -285,7 +292,7 @@ end api_instance = VoucherifySdk::ClientSideApi.new origin = 'origin_example' # String | Indicates the origin (scheme, hostname, and port). opts = { - client_validations_validate_request_body: VoucherifySdk::ClientValidationsValidateRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # ClientValidationsValidateRequestBody | + client_validations_validate_request_body: VoucherifySdk::ClientValidationsValidateRequestBody.new # ClientValidationsValidateRequestBody | } begin diff --git a/docs/ClientValidationsValidateRequestBody.md b/docs/ClientValidationsValidateRequestBody.md index c4184377..15c696ef 100644 --- a/docs/ClientValidationsValidateRequestBody.md +++ b/docs/ClientValidationsValidateRequestBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemables** | [**Array<StackableValidateRedeemBaseRedeemablesItem>**](StackableValidateRedeemBaseRedeemablesItem.md) | An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. | | +| **options** | [**ClientValidationsValidateRequestBodyOptions**](ClientValidationsValidateRequestBodyOptions.md) | | [optional] | +| **redeemables** | [**Array<ClientValidationsValidateRequestBodyRedeemablesItem>**](ClientValidationsValidateRequestBodyRedeemablesItem.md) | | [optional] | | **order** | [**Order**](Order.md) | | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | | **session** | [**Session**](Session.md) | | [optional] | | **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | | **metadata** | **Object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] | -| **options** | [**ClientValidationsValidateRequestBodyAllOfOptions**](ClientValidationsValidateRequestBodyAllOfOptions.md) | | [optional] | diff --git a/docs/ClientValidationsValidateRequestBodyAllOfOptions.md b/docs/ClientValidationsValidateRequestBodyAllOfOptions.md deleted file mode 100644 index e681221b..00000000 --- a/docs/ClientValidationsValidateRequestBodyAllOfOptions.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::ClientValidationsValidateRequestBodyAllOfOptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **expand** | **Array<String>** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] | - diff --git a/docs/ClientValidationsValidateRequestBodyOptions.md b/docs/ClientValidationsValidateRequestBodyOptions.md new file mode 100644 index 00000000..17985488 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyOptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ClientValidationsValidateRequestBodyOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expand** | **Array<String>** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] | + diff --git a/docs/ClientValidationsValidateRequestBodyRedeemablesItem.md b/docs/ClientValidationsValidateRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..fee07513 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyRedeemablesItem.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ClientValidationsValidateRequestBodyRedeemablesItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | +| **id** | **String** | | [optional] | +| **gift** | [**ClientValidationsValidateRequestBodyRedeemablesItemGift**](ClientValidationsValidateRequestBodyRedeemablesItemGift.md) | | [optional] | +| **reward** | [**ClientValidationsValidateRequestBodyRedeemablesItemReward**](ClientValidationsValidateRequestBodyRedeemablesItemReward.md) | | [optional] | + diff --git a/docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md b/docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..312bffbe --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ClientValidationsValidateRequestBodyRedeemablesItemGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **credits** | **Integer** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | + diff --git a/docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md b/docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..682bdd21 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ClientValidationsValidateRequestBodyRedeemablesItemReward + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] | +| **points** | **Integer** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBody.md b/docs/ClientValidationsValidateResponseBody.md index b95477b5..f57c9ce8 100644 --- a/docs/ClientValidationsValidateResponseBody.md +++ b/docs/ClientValidationsValidateResponseBody.md @@ -4,11 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **valid** | **Boolean** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | | -| **redeemables** | [**Array<ValidationsValidateAllResponseBodyRedeemablesItem>**](ValidationsValidateAllResponseBodyRedeemablesItem.md) | Lists validation results of each redeemable. If redeemables_application_mode=\"PARTIAL\" all redeemables here will be \"APPLICABLE\" | | -| **skipped_redeemables** | [**Array<ValidationsRedeemableInapplicable>**](ValidationsRedeemableInapplicable.md) | Lists validation results of each skipped redeemable. | [optional] | +| **valid** | **Boolean** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | [optional] | +| **redeemables** | [**Array<ClientValidationsValidateResponseBodyRedeemablesItem>**](ClientValidationsValidateResponseBodyRedeemablesItem.md) | | [optional] | +| **skipped_redeemables** | [**Array<ValidationsRedeemableSkipped>**](ValidationsRedeemableSkipped.md) | Lists validation results of each skipped redeemable. | [optional] | | **inapplicable_redeemables** | [**Array<ValidationsRedeemableInapplicable>**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] | | **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | | **tracking_id** | **String** | Hashed customer source ID. | [optional] | | **session** | [**Session**](Session.md) | | [optional] | +| **stacking_rules** | [**StackingRules**](StackingRules.md) | | | diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md new file mode 100644 index 00000000..7766700f --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md @@ -0,0 +1,16 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | | [optional] | +| **id** | **String** | Redeemable ID, i.e. the voucher code. | [optional] | +| **object** | **String** | Redeemable's object type. | [optional] | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | +| **applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] | +| **inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] | +| **result** | [**ClientValidationsValidateResponseBodyRedeemablesItemResult**](ClientValidationsValidateResponseBodyRedeemablesItemResult.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md new file mode 100644 index 00000000..1abe07cb --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md @@ -0,0 +1,12 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount**](ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) | | [optional] | +| **gift** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultGift**](ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md) | | [optional] | +| **loyalty_card** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard**](ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) | | [optional] | +| **error** | [**Error**](Error.md) | | [optional] | +| **details** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultDetails**](ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md) | | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md new file mode 100644 index 00000000..6aa32b61 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **key** | **String** | | [optional] | +| **message** | **String** | | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md new file mode 100644 index 00000000..6f75c985 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md @@ -0,0 +1,24 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **amount_off** | **Float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] | +| **amount_off_formula** | **String** | | [optional] | +| **aggregated_amount_limit** | **Integer** | Maximum discount amount per order. | [optional] | +| **effect** | **String** | | [optional] | +| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | +| **unit_off** | **Integer** | Number of units to be granted a full value discount. | [optional] | +| **unit_off_formula** | **String** | | [optional] | +| **unit_type** | **String** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] | +| **product** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct**](ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) | | [optional] | +| **sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] | +| **units** | [**Array<DiscountUnitMultipleOneUnit>**](DiscountUnitMultipleOneUnit.md) | | [optional] | +| **percent_off** | **Float** | The percent discount that the customer will receive. | [optional] | +| **percent_off_formula** | **String** | | [optional] | +| **amount_limit** | **Float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] | +| **fixed_amount** | **Float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] | +| **fixed_amount_formula** | **String** | | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md new file mode 100644 index 00000000..02158aa1 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique product ID, assigned by Voucherify. | [optional] | +| **source_id** | **String** | Product's source ID. | [optional] | +| **name** | **String** | Product name. | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md new file mode 100644 index 00000000..265869bd --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **credits** | **Integer** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | + diff --git a/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md new file mode 100644 index 00000000..55319ecf --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total number of loyalty points to be applied in the redemption. | [optional] | + diff --git a/docs/CodeConfig.md b/docs/CodeConfig.md index 7c57bdd3..191a8133 100644 --- a/docs/CodeConfig.md +++ b/docs/CodeConfig.md @@ -9,5 +9,5 @@ | **prefix** | **String** | A text appended before the code. | [optional] | | **postfix** | **String** | A text appended after the code. | [optional] | | **pattern** | **String** | A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. | [optional] | -| **initial_count** | **Integer** | The initial count | [optional] | +| **initial_count** | **Integer** | Internal value, does not change anything if provided. | [optional] | diff --git a/docs/CodeConfigRequiredLengthCharsetPattern.md b/docs/CodeConfigRequiredLengthCharsetPattern.md deleted file mode 100644 index 1c5375c6..00000000 --- a/docs/CodeConfigRequiredLengthCharsetPattern.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::CodeConfigRequiredLengthCharsetPattern - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **length** | **Float** | Number of characters in a generated code (excluding prefix and postfix). | | -| **charset** | **String** | Characters that can appear in the code. Examples: - Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` - Numbers: `0123456789` - Custom: a custom character set | | -| **prefix** | **String** | A text appended before the code. | [optional] | -| **postfix** | **String** | A text appended after the code. | [optional] | -| **pattern** | **String** | A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. | | -| **initial_count** | **Integer** | The initial count | [optional] | - diff --git a/docs/CreatePublicationBase.md b/docs/CreatePublicationBase.md deleted file mode 100644 index cce1f64d..00000000 --- a/docs/CreatePublicationBase.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::CreatePublicationBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] | -| **customer** | [**Customer**](Customer.md) | | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] | - diff --git a/docs/CreatePublicationCampaign.md b/docs/CreatePublicationCampaign.md index 3071e239..b5398446 100644 --- a/docs/CreatePublicationCampaign.md +++ b/docs/CreatePublicationCampaign.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify. | | +| **name** | **String** | Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify. | [optional] | | **count** | **Integer** | Number of vouchers to be published to customer. | [optional] | diff --git a/docs/CreatePublicationWithCampaign.md b/docs/CreatePublicationWithCampaign.md deleted file mode 100644 index 61b027bf..00000000 --- a/docs/CreatePublicationWithCampaign.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::CreatePublicationWithCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] | -| **customer** | [**Customer**](Customer.md) | | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] | -| **campaign** | [**CreatePublicationCampaign**](CreatePublicationCampaign.md) | | | - diff --git a/docs/CreatePublicationWithSpecificVoucher.md b/docs/CreatePublicationWithSpecificVoucher.md deleted file mode 100644 index 5ced831b..00000000 --- a/docs/CreatePublicationWithSpecificVoucher.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::CreatePublicationWithSpecificVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] | -| **customer** | [**Customer**](Customer.md) | | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] | -| **voucher** | **String** | Code of voucher being published. | | - diff --git a/docs/CustomEvent.md b/docs/CustomEvent.md deleted file mode 100644 index 9cd728d6..00000000 --- a/docs/CustomEvent.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::CustomEvent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique custom event ID. | [optional] | -| **object** | **String** | The object represented is an `event`. | [default to 'event'] | -| **type** | **String** | The event name. | | -| **customer** | [**SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | | -| **referral** | [**CustomEventReferral**](CustomEventReferral.md) | | | -| **loyalty** | **Object** | | | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the custom event. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the custom event was created in ISO 8601 format. | [optional] | - diff --git a/docs/CustomEventReferral.md b/docs/CustomEventReferral.md deleted file mode 100644 index a8a40f41..00000000 --- a/docs/CustomEventReferral.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::CustomEventReferral - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **code** | **String** | Voucher code. | [optional] | -| **id** | **String** | Unique voucher ID. | [optional] | - diff --git a/docs/Customer.md b/docs/Customer.md index 7d2082c7..42de4ce6 100644 --- a/docs/Customer.md +++ b/docs/Customer.md @@ -4,14 +4,14 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **id** | **String** | The ID of an existing customer. | [optional] | +| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | | **name** | **String** | Customer's first and last name. | [optional] | | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomerAddress**](CustomerAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | -| **id** | **String** | The ID of an existing customer. | [optional] | -| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | diff --git a/docs/CustomerActivity.md b/docs/CustomerActivity.md index 7812b134..98877fbd 100644 --- a/docs/CustomerActivity.md +++ b/docs/CustomerActivity.md @@ -6,6 +6,7 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique event ID, assigned by Voucherify. | [optional] | | **type** | **String** | Event type. | [optional] | -| **data** | [**Array<CustomerActivityData>**](CustomerActivityData.md) | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] | +| **data** | **Object** | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] | | **created_at** | **Time** | Timestamp representing the date and time when the customer activity occurred in ISO 8601 format. | [optional] | +| **group_id** | **String** | Unique identifier of the request that caused the event. | [optional] | diff --git a/docs/CustomerActivityData.md b/docs/CustomerActivityData.md deleted file mode 100644 index 6cb4c706..00000000 --- a/docs/CustomerActivityData.md +++ /dev/null @@ -1,183 +0,0 @@ -# VoucherifySdk::CustomerActivityData - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::CustomerActivityData.openapi_one_of -# => -# [ -# :'EventCustomerActiveCampaignFailed', -# :'EventCustomerActiveCampaignRecovered', -# :'EventCustomerActiveCampaignSent', -# :'EventCustomerBatchFailed', -# :'EventCustomerBatchRecovered', -# :'EventCustomerBatchSent', -# :'EventCustomerBrazeFailed', -# :'EventCustomerBrazeRecovered', -# :'EventCustomerBrazeSent', -# :'EventCustomerConfirmed', -# :'EventCustomerConsentsGiven', -# :'EventCustomerConsentsRevoked', -# :'EventCustomerCreated', -# :'EventCustomerCustomEvent', -# :'EventCustomerDeleted', -# :'EventCustomerEmailFailed', -# :'EventCustomerEmailRecovered', -# :'EventCustomerEmailSent', -# :'EventCustomerGiftVoucherBalanceAdded', -# :'EventCustomerIntercomFailed', -# :'EventCustomerIntercomRecovered', -# :'EventCustomerIntercomSent', -# :'EventCustomerKlaviyoFailed', -# :'EventCustomerKlaviyoRecovered', -# :'EventCustomerKlaviyoSent', -# :'EventCustomerLoyaltyCardPointsAdded', -# :'EventCustomerLoyaltyCardPointsTransferred', -# :'EventCustomerLoyaltyTierDowngraded', -# :'EventCustomerLoyaltyTierExpirationChanged', -# :'EventCustomerLoyaltyTierJoined', -# :'EventCustomerLoyaltyTierLeft', -# :'EventCustomerLoyaltyTierProlonged', -# :'EventCustomerLoyaltyTierUpgraded', -# :'EventCustomerLoyaltyUpdated', -# :'EventCustomerMailchimpFailed', -# :'EventCustomerMailchimpRecovered', -# :'EventCustomerMailchimpSent', -# :'EventCustomerOrderCanceled', -# :'EventCustomerOrderCreated', -# :'EventCustomerOrderFulfilled', -# :'EventCustomerOrderPaid', -# :'EventCustomerOrderProcessing', -# :'EventCustomerOrderUpdated', -# :'EventCustomerPublicationFailed', -# :'EventCustomerPublicationSucceeded', -# :'EventCustomerRedemptionFailed', -# :'EventCustomerRedemptionRollbackFailed', -# :'EventCustomerRedemptionRollbackSucceeded', -# :'EventCustomerRedemptionSucceeded', -# :'EventCustomerReferred', -# :'EventCustomerRewardRedemptionsCompleted', -# :'EventCustomerRewardRedemptionsCreated', -# :'EventCustomerRewardRedemptionsPending', -# :'EventCustomerRewardRedemptionsRolledBack', -# :'EventCustomerRewarded', -# :'EventCustomerRewardedLoyaltyPoints', -# :'EventCustomerSegmentEntered', -# :'EventCustomerSegmentLeft', -# :'EventCustomerShopifyFailed', -# :'EventCustomerShopifyRecovered', -# :'EventCustomerShopifySent', -# :'EventCustomerSmsFailed', -# :'EventCustomerSmsRecovered', -# :'EventCustomerSmsSent', -# :'EventCustomerUpdated', -# :'EventCustomerValidationFailed', -# :'EventCustomerValidationSucceeded', -# :'EventCustomerVoucherDeleted', -# :'EventCustomerVouchersLoyaltyPointsExpired' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::CustomerActivityData.build(data) -# => # - -VoucherifySdk::CustomerActivityData.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `EventCustomerActiveCampaignFailed` -- `EventCustomerActiveCampaignRecovered` -- `EventCustomerActiveCampaignSent` -- `EventCustomerBatchFailed` -- `EventCustomerBatchRecovered` -- `EventCustomerBatchSent` -- `EventCustomerBrazeFailed` -- `EventCustomerBrazeRecovered` -- `EventCustomerBrazeSent` -- `EventCustomerConfirmed` -- `EventCustomerConsentsGiven` -- `EventCustomerConsentsRevoked` -- `EventCustomerCreated` -- `EventCustomerCustomEvent` -- `EventCustomerDeleted` -- `EventCustomerEmailFailed` -- `EventCustomerEmailRecovered` -- `EventCustomerEmailSent` -- `EventCustomerGiftVoucherBalanceAdded` -- `EventCustomerIntercomFailed` -- `EventCustomerIntercomRecovered` -- `EventCustomerIntercomSent` -- `EventCustomerKlaviyoFailed` -- `EventCustomerKlaviyoRecovered` -- `EventCustomerKlaviyoSent` -- `EventCustomerLoyaltyCardPointsAdded` -- `EventCustomerLoyaltyCardPointsTransferred` -- `EventCustomerLoyaltyTierDowngraded` -- `EventCustomerLoyaltyTierExpirationChanged` -- `EventCustomerLoyaltyTierJoined` -- `EventCustomerLoyaltyTierLeft` -- `EventCustomerLoyaltyTierProlonged` -- `EventCustomerLoyaltyTierUpgraded` -- `EventCustomerLoyaltyUpdated` -- `EventCustomerMailchimpFailed` -- `EventCustomerMailchimpRecovered` -- `EventCustomerMailchimpSent` -- `EventCustomerOrderCanceled` -- `EventCustomerOrderCreated` -- `EventCustomerOrderFulfilled` -- `EventCustomerOrderPaid` -- `EventCustomerOrderProcessing` -- `EventCustomerOrderUpdated` -- `EventCustomerPublicationFailed` -- `EventCustomerPublicationSucceeded` -- `EventCustomerRedemptionFailed` -- `EventCustomerRedemptionRollbackFailed` -- `EventCustomerRedemptionRollbackSucceeded` -- `EventCustomerRedemptionSucceeded` -- `EventCustomerReferred` -- `EventCustomerRewardRedemptionsCompleted` -- `EventCustomerRewardRedemptionsCreated` -- `EventCustomerRewardRedemptionsPending` -- `EventCustomerRewardRedemptionsRolledBack` -- `EventCustomerRewarded` -- `EventCustomerRewardedLoyaltyPoints` -- `EventCustomerSegmentEntered` -- `EventCustomerSegmentLeft` -- `EventCustomerShopifyFailed` -- `EventCustomerShopifyRecovered` -- `EventCustomerShopifySent` -- `EventCustomerSmsFailed` -- `EventCustomerSmsRecovered` -- `EventCustomerSmsSent` -- `EventCustomerUpdated` -- `EventCustomerValidationFailed` -- `EventCustomerValidationSucceeded` -- `EventCustomerVoucherDeleted` -- `EventCustomerVouchersLoyaltyPointsExpired` -- `nil` (if no type matches) - diff --git a/docs/CustomerAddress.md b/docs/CustomerAddress.md new file mode 100644 index 00000000..19041d72 --- /dev/null +++ b/docs/CustomerAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomerAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomerBase.md b/docs/CustomerBase.md deleted file mode 100644 index 111b8c55..00000000 --- a/docs/CustomerBase.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::CustomerBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Customer's first and last name. | [optional] | -| **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | -| **email** | **String** | Customer's email address. | [optional] | -| **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | - diff --git a/docs/CustomerBaseAddress.md b/docs/CustomerBaseAddress.md deleted file mode 100644 index c46cb694..00000000 --- a/docs/CustomerBaseAddress.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::CustomerBaseAddress - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **city** | **String** | City | [optional] | -| **state** | **String** | State | [optional] | -| **line_1** | **String** | First line of address. | [optional] | -| **line_2** | **String** | Second line of address. | [optional] | -| **country** | **String** | Country. | [optional] | -| **postal_code** | **String** | Postal code. | [optional] | - diff --git a/docs/CustomerId.md b/docs/CustomerId.md index d2ba73aa..11f29d72 100644 --- a/docs/CustomerId.md +++ b/docs/CustomerId.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier of an existing customer. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | diff --git a/docs/CustomerLoyalty.md b/docs/CustomerLoyalty.md index b58c7733..48f36afe 100644 --- a/docs/CustomerLoyalty.md +++ b/docs/CustomerLoyalty.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Customer's loyalty points. | | -| **referred_customers** | **Integer** | Total number of customers referred by the customer. | | -| **campaigns** | [**Hash<String, CustomerLoyaltyCampaignsValue>**](CustomerLoyaltyCampaignsValue.md) | Contains campaigns with details about point balances and how many customers were referred by the customer. | | +| **points** | **Integer** | Customer's loyalty points. | [optional] | +| **referred_customers** | **Integer** | Total number of customers referred by the customer. | [optional] | +| **campaigns** | [**Hash<String, CustomerLoyaltyCampaignsEntry>**](CustomerLoyaltyCampaignsEntry.md) | Contains campaigns with details about point balances and how many customers were referred by the customer. | [optional] | diff --git a/docs/CustomerLoyaltyCampaignsEntry.md b/docs/CustomerLoyaltyCampaignsEntry.md new file mode 100644 index 00000000..d3d168f2 --- /dev/null +++ b/docs/CustomerLoyaltyCampaignsEntry.md @@ -0,0 +1,10 @@ +# VoucherifySdk::CustomerLoyaltyCampaignsEntry + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Remaining point balance in campaign. | [optional] | +| **loyalty_tier** | **String** | Customer's loyalty tier within the campaign. | [optional] | +| **referred_customers** | **Integer** | Number of customers referred by the customer in campaign. | [optional] | + diff --git a/docs/CustomerLoyaltyCampaignsValue.md b/docs/CustomerLoyaltyCampaignsValue.md deleted file mode 100644 index 0ccc7cf7..00000000 --- a/docs/CustomerLoyaltyCampaignsValue.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::CustomerLoyaltyCampaignsValue - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Remaining point balance in campaign. | [optional] | -| **loyalty_tier** | **String** | Customer's loyalty tier within the campaign. | [optional] | -| **referred_customers** | **Integer** | Number of customers referred by the customer in campaign. | [optional] | - diff --git a/docs/CustomerRedeemable.md b/docs/CustomerRedeemable.md new file mode 100644 index 00000000..1903d549 --- /dev/null +++ b/docs/CustomerRedeemable.md @@ -0,0 +1,17 @@ +# VoucherifySdk::CustomerRedeemable + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redeemable holder identifier. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the redeemable was assigned. The value is shown in the ISO 8601 format. | [optional] | +| **redeemable_id** | **String** | Identifier of the redeemable item. | [optional] | +| **redeemable_object** | **String** | Type of the redeemable. | [optional] | +| **customer_id** | **String** | Identifier of the customer. | [optional] | +| **holder_role** | **String** | Role of the holder. | [optional][default to 'OWNER'] | +| **campaign_id** | **String** | Unique campaign identifier, assigned by Voucherify. | [optional] | +| **campaign_type** | **String** | Defines the type of the campaign. | [optional][default to 'DISCOUNT_COUPONS'] | +| **voucher_type** | **String** | Defines the type of the voucher. | [optional][default to 'DISCOUNT_VOUCHER'] | +| **redeemable** | [**CustomerRedeemableRedeemable**](CustomerRedeemableRedeemable.md) | | [optional] | + diff --git a/docs/CustomerRedeemableRedeemable.md b/docs/CustomerRedeemableRedeemable.md new file mode 100644 index 00000000..95de1c55 --- /dev/null +++ b/docs/CustomerRedeemableRedeemable.md @@ -0,0 +1,10 @@ +# VoucherifySdk::CustomerRedeemableRedeemable + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of the redeemable. | [optional] | +| **voucher** | [**RedeemableVoucher**](RedeemableVoucher.md) | | | +| **status** | **String** | Status of the redeemable. | [optional][default to 'ACTIVE'] | + diff --git a/docs/CustomerReferrals.md b/docs/CustomerReferrals.md index d2a2774a..2014fac4 100644 --- a/docs/CustomerReferrals.md +++ b/docs/CustomerReferrals.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **total** | **Integer** | Total number of times this customer received a referral, i.e. was referred by another customer. | | -| **campaigns** | [**Array<CustomerReferralsCampaignsItem>**](CustomerReferralsCampaignsItem.md) | Contains an array of campaigns that served as the source of a referral for the customer. | | +| **total** | **Integer** | Total number of times this customer received a referral, i.e. was referred by another customer. | [optional] | +| **campaigns** | [**Array<CustomerReferralsCampaignsItem>**](CustomerReferralsCampaignsItem.md) | Contains an array of campaigns that served as the source of a referral for the customer. | [optional] | diff --git a/docs/CustomerResponseDataAssets.md b/docs/CustomerResponseDataAssets.md deleted file mode 100644 index 15f98b15..00000000 --- a/docs/CustomerResponseDataAssets.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::CustomerResponseDataAssets - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **cockpit_url** | **String** | Customer's cockpit URL address. | [optional] | - diff --git a/docs/CustomerSegmentsList.md b/docs/CustomerSegmentsList.md deleted file mode 100644 index 86baeb0a..00000000 --- a/docs/CustomerSegmentsList.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::CustomerSegmentsList - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about customer segments. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of segment IDs. | [default to 'data'] | -| **data** | [**Array<SimpleSegment>**](SimpleSegment.md) | A dictionary that contains an array of segment IDs and names. | | -| **total** | **Integer** | Total number of segments the customer belongs to. | | - diff --git a/docs/CustomerSummaryOrders.md b/docs/CustomerSummaryOrders.md index ea551070..03ed319c 100644 --- a/docs/CustomerSummaryOrders.md +++ b/docs/CustomerSummaryOrders.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **total_amount** | **Integer** | The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | | -| **total_count** | **Integer** | Total number of orders made by the customer. | | -| **average_amount** | **Integer** | Average amount spent on orders. `total_amount` &divide; `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | | -| **last_order_amount** | **Integer** | Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | | +| **total_amount** | **Integer** | The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | +| **total_count** | **Integer** | Total number of orders made by the customer. | [optional] | +| **average_amount** | **Integer** | Average amount spent on orders. `total_amount` &divide; `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | +| **last_order_amount** | **Integer** | Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | | **last_order_date** | **Time** | Timestamp representing the date and time of the customer's last order in ISO 8601 format. | [optional] | diff --git a/docs/CustomerSummaryRedemptions.md b/docs/CustomerSummaryRedemptions.md index 88a085bb..fe8a200b 100644 --- a/docs/CustomerSummaryRedemptions.md +++ b/docs/CustomerSummaryRedemptions.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **total_redeemed** | **Integer** | Total number of redemptions made by the customer. | | -| **total_failed** | **Integer** | Total number of redemptions that failed. | | -| **total_succeeded** | **Integer** | Total number of redemptions that succeeded. | | -| **total_rolled_back** | **Integer** | Total number of redemptions that were rolled back for the customer. | | -| **total_rollback_failed** | **Integer** | Total number of redemption rollbacks that failed. | | -| **total_rollback_succeeded** | **Integer** | Total number of redemption rollbacks that succeeded. | | -| **gift** | [**CustomerSummaryRedemptionsGift**](CustomerSummaryRedemptionsGift.md) | | | -| **loyalty_card** | [**CustomerSummaryRedemptionsLoyaltyCard**](CustomerSummaryRedemptionsLoyaltyCard.md) | | | +| **total_redeemed** | **Integer** | Total number of redemptions made by the customer. | [optional] | +| **total_failed** | **Integer** | Total number of redemptions that failed. | [optional] | +| **total_succeeded** | **Integer** | Total number of redemptions that succeeded. | [optional] | +| **total_rolled_back** | **Integer** | Total number of redemptions that were rolled back for the customer. | [optional] | +| **total_rollback_failed** | **Integer** | Total number of redemption rollbacks that failed. | [optional] | +| **total_rollback_succeeded** | **Integer** | Total number of redemption rollbacks that succeeded. | [optional] | +| **gift** | [**CustomerSummaryRedemptionsGift**](CustomerSummaryRedemptionsGift.md) | | [optional] | +| **loyalty_card** | [**CustomerSummaryRedemptionsLoyaltyCard**](CustomerSummaryRedemptionsLoyaltyCard.md) | | [optional] | diff --git a/docs/CustomerSummaryRedemptionsGift.md b/docs/CustomerSummaryRedemptionsGift.md index 4e64ca3f..beacdfe6 100644 --- a/docs/CustomerSummaryRedemptionsGift.md +++ b/docs/CustomerSummaryRedemptionsGift.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemed_amount** | **Integer** | Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [default to 0] | -| **amount_to_go** | **Integer** | Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [default to 0] | +| **redeemed_amount** | **Integer** | Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional][default to 0] | +| **amount_to_go** | **Integer** | Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional][default to 0] | diff --git a/docs/CustomerSummaryRedemptionsLoyaltyCard.md b/docs/CustomerSummaryRedemptionsLoyaltyCard.md index 0bec98eb..7cc97142 100644 --- a/docs/CustomerSummaryRedemptionsLoyaltyCard.md +++ b/docs/CustomerSummaryRedemptionsLoyaltyCard.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemed_points** | **Integer** | Total number of loyalty points redeemed by the customer. | | -| **points_to_go** | **Integer** | Sum of remaining available point balance across all loyalty cards. | | +| **redeemed_points** | **Integer** | Total number of loyalty points redeemed by the customer. | [optional] | +| **points_to_go** | **Integer** | Sum of remaining available point balance across all loyalty cards. | [optional] | diff --git a/docs/CustomerWithSummaryLoyaltyReferrals.md b/docs/CustomerWithSummaryLoyaltyReferrals.md index eb066145..f62be335 100644 --- a/docs/CustomerWithSummaryLoyaltyReferrals.md +++ b/docs/CustomerWithSummaryLoyaltyReferrals.md @@ -4,22 +4,22 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | +| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | +| **summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] | +| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] | +| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] | +| **system_metadata** | **Object** | Object used to store system metadata information. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] | +| **assets** | [**CustomerWithSummaryLoyaltyReferralsAssets**](CustomerWithSummaryLoyaltyReferralsAssets.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | | **name** | **String** | Customer's first and last name. | [optional] | | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomerWithSummaryLoyaltyReferralsAddress**](CustomerWithSummaryLoyaltyReferralsAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | -| **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | -| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | -| **summary** | [**CustomerSummary**](CustomerSummary.md) | | | -| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | | -| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | | -| **system_metadata** | **Object** | Object used to store system metadata information. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the customer was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated in ISO 8601 format. | [optional] | -| **assets** | [**CustomerResponseDataAssets**](CustomerResponseDataAssets.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | diff --git a/docs/CustomerWithSummaryLoyaltyReferralsAddress.md b/docs/CustomerWithSummaryLoyaltyReferralsAddress.md new file mode 100644 index 00000000..f9ac7e59 --- /dev/null +++ b/docs/CustomerWithSummaryLoyaltyReferralsAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomerWithSummaryLoyaltyReferralsAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomerWithSummaryLoyaltyReferralsAssets.md b/docs/CustomerWithSummaryLoyaltyReferralsAssets.md new file mode 100644 index 00000000..e36c99d6 --- /dev/null +++ b/docs/CustomerWithSummaryLoyaltyReferralsAssets.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CustomerWithSummaryLoyaltyReferralsAssets + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cockpit_url** | **String** | Customer's cockpit URL address. | [optional] | + diff --git a/docs/CustomersActivitiesListResponseBody.md b/docs/CustomersActivitiesListResponseBody.md index 3b180dd0..0687faa5 100644 --- a/docs/CustomersActivitiesListResponseBody.md +++ b/docs/CustomersActivitiesListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about customer activities in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of customer activity objects. | [default to 'data'] | -| **data** | [**Array<CustomerActivity>**](CustomerActivity.md) | Array of customer activity objects. | | -| **total** | **Integer** | Total number of customer activities. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about customer activities in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of customer activity objects. | [optional][default to 'data'] | +| **data** | [**Array<CustomerActivity>**](CustomerActivity.md) | Array of customer activity objects. | [optional] | +| **total** | **Integer** | Total number of customer activities. | [optional] | diff --git a/docs/CustomersActivityListResponseBody.md b/docs/CustomersActivityListResponseBody.md new file mode 100644 index 00000000..43f4f794 --- /dev/null +++ b/docs/CustomersActivityListResponseBody.md @@ -0,0 +1,12 @@ +# VoucherifySdk::CustomersActivityListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about customer activities in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of customer activity objects. | [optional][default to 'data'] | +| **data** | [**Array<CustomerActivity>**](CustomerActivity.md) | Array of customer activity objects. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] | +| **more_starting_after** | **String** | Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. | [optional] | + diff --git a/docs/CustomersApi.md b/docs/CustomersApi.md index 35f4de04..41460225 100644 --- a/docs/CustomersApi.md +++ b/docs/CustomersApi.md @@ -9,13 +9,15 @@ All URIs are relative to *https://api.voucherify.io* | [**delete_customer**](CustomersApi.md#delete_customer) | **DELETE** /v1/customers/{customerId} | Delete Customer | | [**get_customer**](CustomersApi.md#get_customer) | **GET** /v1/customers/{customerId} | Get Customer | | [**import_customers_using_csv**](CustomersApi.md#import_customers_using_csv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV | -| [**list_customer_activities**](CustomersApi.md#list_customer_activities) | **GET** /v1/customers/{customerId}/activities | List Customer Activities | +| [**list_customer_activities**](CustomersApi.md#list_customer_activities) | **GET** /v1/customers/{customerId}/activities | List Customer Activities [Deprecated] | +| [**list_customer_activity**](CustomersApi.md#list_customer_activity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity | +| [**list_customer_redeemables**](CustomersApi.md#list_customer_redeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables | | [**list_customer_segments**](CustomersApi.md#list_customer_segments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments | | [**list_customers**](CustomersApi.md#list_customers) | **GET** /v1/customers | List Customers | | [**update_customer**](CustomersApi.md#update_customer) | **PUT** /v1/customers/{customerId} | Update Customer | -| [**update_customers_consents**](CustomersApi.md#update_customers_consents) | **PUT** /v1/customers/{customerId}/consents | Update Customer's consents | -| [**update_customers_in_bulk**](CustomersApi.md#update_customers_in_bulk) | **POST** /v1/customers/bulk/async | Update Customers in bulk | -| [**update_customers_metadata_in_bulk**](CustomersApi.md#update_customers_metadata_in_bulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in bulk | +| [**update_customers_consents**](CustomersApi.md#update_customers_consents) | **PUT** /v1/customers/{customerId}/consents | Update Customer's consents [Deprecated] | +| [**update_customers_in_bulk**](CustomersApi.md#update_customers_in_bulk) | **POST** /v1/customers/bulk/async | Update Customers in Bulk | +| [**update_customers_metadata_in_bulk**](CustomersApi.md#update_customers_metadata_in_bulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in Bulk | ## create_customer @@ -253,7 +255,7 @@ end ## import_customers_using_csv -> import_customers_using_csv(file) +> import_customers_using_csv(opts) Import and Update Customers using CSV @@ -278,11 +280,13 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::CustomersApi.new -file = File.new('/path/to/some/file') # File | File path. +opts = { + file: File.new('/path/to/some/file') # File | File path. +} begin # Import and Update Customers using CSV - result = api_instance.import_customers_using_csv(file) + result = api_instance.import_customers_using_csv(opts) p result rescue VoucherifySdk::ApiError => e puts "Error when calling CustomersApi->import_customers_using_csv: #{e}" @@ -293,7 +297,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **file** | **File** | File path. | | +| **file** | **File** | File path. | [optional] | ### Return type @@ -313,9 +317,9 @@ end > list_customer_activities(customer_id, opts) -List Customer Activities +List Customer Activities [Deprecated] -Retrieve customer activities. +> ❗️ Deprecated This endpoint represents the deprecated version of the API responsible for listing customer activities and we do not recommend using it. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. Retrieve customer activities. ### Examples @@ -338,10 +342,10 @@ end api_instance = VoucherifySdk::CustomersApi.new customer_id = 'customer_id_example' # String | A Voucherify customers id or source ID of the customer who performed the activities. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. order: VoucherifySdk::ParameterOrder::CREATED_AT, # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. - starting_after: Time.parse('2013-10-20T19:20:30+01:00'), # Time | A cursor for use in pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. - starting_after_id: 'starting_after_id_example', # String | By applying this filter value, you will get events starting after an event with the given ID. + starting_after: Time.parse('2013-10-20T19:20:30+01:00'), # Time | A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + starting_after_id: 'starting_after_id_example', # String | A cursor for pagination. It retrieves the events starting after an event with the given ID. campaign_type: VoucherifySdk::ParameterCampaignType::PROMOTION, # ParameterCampaignType | Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM campaign_id: 'campaign_id_example', # String | By applying this parameter you request only events related to specific campaign identified by its ID. product_id: 'product_id_example', # String | By applying this parameter you request only events related to specific product identified by its ID. @@ -350,7 +354,7 @@ opts = { } begin - # List Customer Activities + # List Customer Activities [Deprecated] result = api_instance.list_customer_activities(customer_id, opts) p result rescue VoucherifySdk::ApiError => e @@ -363,10 +367,10 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **customer_id** | **String** | A Voucherify customers id or source ID of the customer who performed the activities. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | | **order** | [**ParameterOrder**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | -| **starting_after** | **Time** | A cursor for use in pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] | -| **starting_after_id** | **String** | By applying this filter value, you will get events starting after an event with the given ID. | [optional] | +| **starting_after** | **Time** | A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] | +| **starting_after_id** | **String** | A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | | **campaign_type** | [**ParameterCampaignType**](.md) | Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM | [optional] | | **campaign_id** | **String** | By applying this parameter you request only events related to specific campaign identified by its ID. | [optional] | | **product_id** | **String** | By applying this parameter you request only events related to specific product identified by its ID. | [optional] | @@ -387,6 +391,152 @@ end - **Accept**: application/json +## list_customer_activity + +> list_customer_activity(customer_id, opts) + +List Customer Activity + +Retrieve customer activities. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::CustomersApi.new +customer_id = 'customer_id_example' # String | A Voucherify customers id or source ID of the customer who performed the activities. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + order: VoucherifySdk::ParameterOrderCreatedAt::CREATED_AT, # ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. + starting_after_id: 'starting_after_id_example', # String | A cursor for pagination. It retrieves the events starting after an event with the given ID. + start_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. + end_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + campaign_id: 'campaign_id_example', # String | Requests only events related to specific campaign identified by its ID. + campaign_type: VoucherifySdk::ParameterCampaignType::PROMOTION, # ParameterCampaignType | Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. + category: VoucherifySdk::ParameterActivityCategory::ACTION, # ParameterActivityCategory | Filters activities for actions or effects. Allowed values: ACTION, EFFECT. + type: 'type_example' # String | Event name of the customer event. +} + +begin + # List Customer Activity + result = api_instance.list_customer_activity(customer_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling CustomersApi->list_customer_activity: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | A Voucherify customers id or source ID of the customer who performed the activities. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderCreatedAt**](.md) | Apply this filter to order the events according the date and time when it was created. | [optional] | +| **starting_after_id** | **String** | A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | +| **start_date** | **Time** | Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. | [optional] | +| **end_date** | **Time** | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | +| **campaign_id** | **String** | Requests only events related to specific campaign identified by its ID. | [optional] | +| **campaign_type** | [**ParameterCampaignType**](.md) | Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. | [optional] | +| **category** | [**ParameterActivityCategory**](.md) | Filters activities for actions or effects. Allowed values: ACTION, EFFECT. | [optional] | +| **type** | **String** | Event name of the customer event. | [optional] | + +### Return type + +[**CustomersActivityListResponseBody**](CustomersActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## list_customer_redeemables + +> list_customer_redeemables(customer_id, opts) + +List Customer's Redeemables + +Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::CustomersApi.new +customer_id = 'customer_id_example' # String | Unique identifier of a customer represented by an internal customer ID or customer source ID. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + order: VoucherifySdk::ParameterOrderListRedeemables::ID, # ParameterOrderListRedeemables | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + starting_after_id: 'starting_after_id_example', # String | A cursor for pagination. It retrieves the events starting after an event with the given ID. + filters: VoucherifySdk::ParameterFiltersListCustomerRedeemables.new # ParameterFiltersListCustomerRedeemables | Filters for listing customer redeemables. +} + +begin + # List Customer's Redeemables + result = api_instance.list_customer_redeemables(customer_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling CustomersApi->list_customer_redeemables: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | Unique identifier of a customer represented by an internal customer ID or customer source ID. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderListRedeemables**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **starting_after_id** | **String** | A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | +| **filters** | [**ParameterFiltersListCustomerRedeemables**](.md) | Filters for listing customer redeemables. | [optional] | + +### Return type + +[**CustomersRedeemablesListResponseBody**](CustomersRedeemablesListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## list_customer_segments > list_customer_segments(customer_id) @@ -473,8 +623,8 @@ end api_instance = VoucherifySdk::CustomersApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. email: 'email_example', # String | Limit the customers to the ones that have this specific email address. city: 'city_example', # String | Limit the customers to the ones that are located in the specified city. name: 'name_example', # String | Filter customers by the name property. @@ -484,7 +634,7 @@ opts = { updated_at_before: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Filter customers by date customer was updated last time. updated_at_after: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Filter customers by date customer was updated last time. order: VoucherifySdk::ParameterOrderListCustomers::CREATED_AT, # ParameterOrderListCustomers | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. - starting_after: Time.parse('2013-10-20T19:20:30+01:00') # Time | A cursor for use in pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + starting_after: Time.parse('2013-10-20T19:20:30+01:00') # Time | A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. } begin @@ -500,8 +650,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **email** | **String** | Limit the customers to the ones that have this specific email address. | [optional] | | **city** | **String** | Limit the customers to the ones that are located in the specified city. | [optional] | | **name** | **String** | Filter customers by the name property. | [optional] | @@ -511,7 +661,7 @@ end | **updated_at_before** | **Time** | Filter customers by date customer was updated last time. | [optional] | | **updated_at_after** | **Time** | Filter customers by date customer was updated last time. | [optional] | | **order** | [**ParameterOrderListCustomers**](.md) | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | -| **starting_after** | **Time** | A cursor for use in pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] | +| **starting_after** | **Time** | A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] | ### Return type @@ -593,9 +743,9 @@ end > update_customers_consents(customer_id, opts) -Update Customer's consents +Update Customer's consents [Deprecated] -Update marketing permissions for the specified customer. +Update marketing permissions for the specified customer. ❗️ Deprecated This endpoint is deprecated. The feature of managing consents will be soon removed from Voucherify, including this endpoint. ### Examples @@ -622,7 +772,7 @@ opts = { } begin - # Update Customer's consents + # Update Customer's consents [Deprecated] api_instance.update_customers_consents(customer_id, opts) rescue VoucherifySdk::ApiError => e puts "Error when calling CustomersApi->update_customers_consents: #{e}" @@ -654,9 +804,9 @@ nil (empty response body) > update_customers_in_bulk(opts) -Update Customers in bulk +Update Customers in Bulk -Update several customers in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. +Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. ### Examples @@ -678,11 +828,11 @@ end api_instance = VoucherifySdk::CustomersApi.new opts = { - customers_update_in_bulk_request_body: [VoucherifySdk::CustomersUpdateInBulkRequestBody.new({source_id: 'source_id_example'})] # Array | Specify the customer fields that you would like to update in each customer object. + customers_update_in_bulk_request_body: [VoucherifySdk::CustomersUpdateInBulkRequestBody.new] # Array | List the customer fields to be updated in each customer object. } begin - # Update Customers in bulk + # Update Customers in Bulk result = api_instance.update_customers_in_bulk(opts) p result rescue VoucherifySdk::ApiError => e @@ -694,7 +844,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customers_update_in_bulk_request_body** | [**Array<CustomersUpdateInBulkRequestBody>**](CustomersUpdateInBulkRequestBody.md) | Specify the customer fields that you would like to update in each customer object. | [optional] | +| **customers_update_in_bulk_request_body** | [**Array<CustomersUpdateInBulkRequestBody>**](CustomersUpdateInBulkRequestBody.md) | List the customer fields to be updated in each customer object. | [optional] | ### Return type @@ -714,9 +864,9 @@ end > update_customers_metadata_in_bulk(opts) -Update Customers' Metadata in bulk +Update Customers' Metadata in Bulk -Update several customers metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. +Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. ### Examples @@ -738,11 +888,11 @@ end api_instance = VoucherifySdk::CustomersApi.new opts = { - customers_metadata_update_in_bulk_request_body: VoucherifySdk::CustomersMetadataUpdateInBulkRequestBody.new({source_ids: ['source_ids_example'], metadata: 3.56}) # CustomersMetadataUpdateInBulkRequestBody | List the source_ids of the customers you would like to update along with the metadata key value pairs. + customers_metadata_update_in_bulk_request_body: VoucherifySdk::CustomersMetadataUpdateInBulkRequestBody.new # CustomersMetadataUpdateInBulkRequestBody | List the source_ids of the customers you would like to update with the metadata key/value pairs. } begin - # Update Customers' Metadata in bulk + # Update Customers' Metadata in Bulk result = api_instance.update_customers_metadata_in_bulk(opts) p result rescue VoucherifySdk::ApiError => e @@ -754,7 +904,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customers_metadata_update_in_bulk_request_body** | [**CustomersMetadataUpdateInBulkRequestBody**](CustomersMetadataUpdateInBulkRequestBody.md) | List the source_ids of the customers you would like to update along with the metadata key value pairs. | [optional] | +| **customers_metadata_update_in_bulk_request_body** | [**CustomersMetadataUpdateInBulkRequestBody**](CustomersMetadataUpdateInBulkRequestBody.md) | List the source_ids of the customers you would like to update with the metadata key/value pairs. | [optional] | ### Return type diff --git a/docs/CustomersCreateRequestBody.md b/docs/CustomersCreateRequestBody.md index 648f557a..7194e8b7 100644 --- a/docs/CustomersCreateRequestBody.md +++ b/docs/CustomersCreateRequestBody.md @@ -10,8 +10,8 @@ | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomersCreateRequestBodyAddress**](CustomersCreateRequestBodyAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/CustomersCreateRequestBodyAddress.md b/docs/CustomersCreateRequestBodyAddress.md new file mode 100644 index 00000000..f50d5644 --- /dev/null +++ b/docs/CustomersCreateRequestBodyAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersCreateRequestBodyAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomersCreateResponseBody.md b/docs/CustomersCreateResponseBody.md index 7a78518e..9bcdaa06 100644 --- a/docs/CustomersCreateResponseBody.md +++ b/docs/CustomersCreateResponseBody.md @@ -6,20 +6,20 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | | **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | -| **summary** | [**CustomerSummary**](CustomerSummary.md) | | | -| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | | -| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | | +| **summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] | +| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] | +| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] | | **system_metadata** | **Object** | Object used to store system metadata information. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the customer was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated in ISO 8601 format. | [optional] | -| **assets** | [**CustomerResponseDataAssets**](CustomerResponseDataAssets.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | +| **created_at** | **Time** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] | +| **assets** | [**CustomersCreateResponseBodyAssets**](CustomersCreateResponseBodyAssets.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | | **name** | **String** | Customer's first and last name. | [optional] | | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomersCreateResponseBodyAddress**](CustomersCreateResponseBodyAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/CustomersCreateResponseBodyAddress.md b/docs/CustomersCreateResponseBodyAddress.md new file mode 100644 index 00000000..294ce713 --- /dev/null +++ b/docs/CustomersCreateResponseBodyAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersCreateResponseBodyAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomersCreateResponseBodyAssets.md b/docs/CustomersCreateResponseBodyAssets.md new file mode 100644 index 00000000..2fb383fd --- /dev/null +++ b/docs/CustomersCreateResponseBodyAssets.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CustomersCreateResponseBodyAssets + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cockpit_url** | **String** | Customer's cockpit URL address. | [optional] | + diff --git a/docs/CustomersGetResponseBody.md b/docs/CustomersGetResponseBody.md index 47b196f2..0b13f260 100644 --- a/docs/CustomersGetResponseBody.md +++ b/docs/CustomersGetResponseBody.md @@ -6,20 +6,20 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | | **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | -| **summary** | [**CustomerSummary**](CustomerSummary.md) | | | -| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | | -| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | | +| **summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] | +| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] | +| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] | | **system_metadata** | **Object** | Object used to store system metadata information. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the customer was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated in ISO 8601 format. | [optional] | -| **assets** | [**CustomerResponseDataAssets**](CustomerResponseDataAssets.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | +| **created_at** | **Time** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] | +| **assets** | [**CustomersGetResponseBodyAssets**](CustomersGetResponseBodyAssets.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | | **name** | **String** | Customer's first and last name. | [optional] | | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomersGetResponseBodyAddress**](CustomersGetResponseBodyAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/CustomersGetResponseBodyAddress.md b/docs/CustomersGetResponseBodyAddress.md new file mode 100644 index 00000000..c97c7869 --- /dev/null +++ b/docs/CustomersGetResponseBodyAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersGetResponseBodyAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomersGetResponseBodyAssets.md b/docs/CustomersGetResponseBodyAssets.md new file mode 100644 index 00000000..452d0c00 --- /dev/null +++ b/docs/CustomersGetResponseBodyAssets.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CustomersGetResponseBodyAssets + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cockpit_url** | **String** | Customer's cockpit URL address. | [optional] | + diff --git a/docs/CustomersImportCsvCreateResponseBody.md b/docs/CustomersImportCsvCreateResponseBody.md index 971a0317..653b841b 100644 --- a/docs/CustomersImportCsvCreateResponseBody.md +++ b/docs/CustomersImportCsvCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/CustomersListResponseBody.md b/docs/CustomersListResponseBody.md index 9312a8a3..6f561236 100644 --- a/docs/CustomersListResponseBody.md +++ b/docs/CustomersListResponseBody.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about customers in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of customer objects. | [default to 'customers'] | -| **customers** | [**Array<CustomerWithSummaryLoyaltyReferrals>**](CustomerWithSummaryLoyaltyReferrals.md) | Contains array of customer objects. | | -| **total** | **Integer** | Total number of customers. | | -| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different end date filter) to get more records returned in the results. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about customers in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of customer objects. | [optional][default to 'customers'] | +| **customers** | [**Array<CustomerWithSummaryLoyaltyReferrals>**](CustomerWithSummaryLoyaltyReferrals.md) | Contains array of customer objects. | [optional] | +| **total** | **Integer** | Total number of customers. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different end date filter) to get more records returned in the results. | [optional] | diff --git a/docs/CustomersMetadataUpdateInBulkRequestBody.md b/docs/CustomersMetadataUpdateInBulkRequestBody.md index aeb417a7..3cd70fcf 100644 --- a/docs/CustomersMetadataUpdateInBulkRequestBody.md +++ b/docs/CustomersMetadataUpdateInBulkRequestBody.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **source_ids** | **Array<String>** | An array of customer `source_id`'s. | | -| **metadata** | **Object** | Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | | +| **source_ids** | **Array<String>** | An array of customer `source_id`'s. | [optional] | +| **metadata** | **Object** | Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/CustomersMetadataUpdateInBulkResponseBody.md b/docs/CustomersMetadataUpdateInBulkResponseBody.md index c48edd9a..5588c39d 100644 --- a/docs/CustomersMetadataUpdateInBulkResponseBody.md +++ b/docs/CustomersMetadataUpdateInBulkResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/CustomersPermanentDeletionCreateResponseBody.md b/docs/CustomersPermanentDeletionCreateResponseBody.md index d437c576..51d9a572 100644 --- a/docs/CustomersPermanentDeletionCreateResponseBody.md +++ b/docs/CustomersPermanentDeletionCreateResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique permanent deletion object ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format. | | -| **related_object_id** | **String** | Unique customer ID that is being deleted. | | -| **related_object** | **String** | Object being deleted. | [default to 'customer'] | -| **status** | **String** | Deletion status. | [default to 'DONE'] | -| **data_json** | [**CustomersPermanentDeletionCreateResponseBodyDataJson**](CustomersPermanentDeletionCreateResponseBodyDataJson.md) | | | -| **object** | **String** | The type of object represented by JSON. | [default to 'pernament_deletion'] | +| **id** | **String** | Unique permanent deletion object ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format. | [optional] | +| **related_object_id** | **String** | Unique customer ID that is being deleted. | [optional] | +| **related_object** | **String** | Object being deleted. | [optional][default to 'customer'] | +| **status** | **String** | Deletion status. | [optional][default to 'DONE'] | +| **data_json** | [**CustomersPermanentDeletionCreateResponseBodyDataJson**](CustomersPermanentDeletionCreateResponseBodyDataJson.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'pernament_deletion'] | diff --git a/docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md b/docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md index 218782a0..9c3b058c 100644 --- a/docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md +++ b/docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **events** | **Integer** | Number of events deleted. | | -| **customer_events** | **Integer** | Number of customer events deleted. | | -| **daily_events** | **Integer** | Number of daily events deleted. | | -| **segments** | **Integer** | Number of segments deleted. | | -| **orders** | **Integer** | Number of orders deleted. | | -| **order_events** | **Integer** | Number of order events deleted. | | -| **customer** | **Integer** | Number of customers deleted. | [default to 1] | +| **events** | **Integer** | Number of events deleted. | [optional] | +| **customer_events** | **Integer** | Number of customer events deleted. | [optional] | +| **daily_events** | **Integer** | Number of daily events deleted. | [optional] | +| **segments** | **Integer** | Number of segments deleted. | [optional] | +| **orders** | **Integer** | Number of orders deleted. | [optional] | +| **order_events** | **Integer** | Number of order events deleted. | [optional] | +| **customer** | **Integer** | Number of customers deleted. | [optional][default to 1] | diff --git a/docs/CustomersRedeemablesListResponseBody.md b/docs/CustomersRedeemablesListResponseBody.md new file mode 100644 index 00000000..8007e339 --- /dev/null +++ b/docs/CustomersRedeemablesListResponseBody.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersRedeemablesListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about customer redeemables. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of redeemables. | [optional][default to 'data'] | +| **data** | [**Array<CustomerRedeemable>**](CustomerRedeemable.md) | A dictionary that contains an array of redeemables. | [optional] | +| **total** | **Integer** | Total number of results returned. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] | +| **more_starting_after** | **String** | Returns an ID that can be used to return another page of results. Use the ID in the `starting_after_id` query parameter to display another page of the results occuring after the field with that ID. | [optional] | + diff --git a/docs/CustomersSegmentsListResponseBody.md b/docs/CustomersSegmentsListResponseBody.md index b0bfa96e..c8c08a48 100644 --- a/docs/CustomersSegmentsListResponseBody.md +++ b/docs/CustomersSegmentsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about customer segments. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of segment IDs. | [default to 'data'] | -| **data** | [**Array<SimpleSegment>**](SimpleSegment.md) | A dictionary that contains an array of segment IDs and names. | | -| **total** | **Integer** | Total number of segments the customer belongs to. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about customer segments. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of segment IDs. | [optional][default to 'data'] | +| **data** | [**Array<SimpleSegment>**](SimpleSegment.md) | A dictionary that contains an array of segment IDs and names. | [optional] | +| **total** | **Integer** | Total number of segments the customer belongs to. | [optional] | diff --git a/docs/CustomersUpdateInBulkRequestBody.md b/docs/CustomersUpdateInBulkRequestBody.md index ed2aa3ca..2242e402 100644 --- a/docs/CustomersUpdateInBulkRequestBody.md +++ b/docs/CustomersUpdateInBulkRequestBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **source_id** | **String** | Unique customer source ID. | [optional] | | **name** | **String** | Customer's first and last name. | [optional] | | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomersUpdateInBulkRequestBodyAddress**](CustomersUpdateInBulkRequestBodyAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | -| **source_id** | **String** | Unique customer source ID. | | diff --git a/docs/CustomersUpdateInBulkRequestBodyAddress.md b/docs/CustomersUpdateInBulkRequestBodyAddress.md new file mode 100644 index 00000000..b88bb39e --- /dev/null +++ b/docs/CustomersUpdateInBulkRequestBodyAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersUpdateInBulkRequestBodyAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomersUpdateInBulkResponseBody.md b/docs/CustomersUpdateInBulkResponseBody.md index 1e4ac2c2..a6dbb96f 100644 --- a/docs/CustomersUpdateInBulkResponseBody.md +++ b/docs/CustomersUpdateInBulkResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/CustomersUpdateRequestBody.md b/docs/CustomersUpdateRequestBody.md index e354dbd3..ab857e17 100644 --- a/docs/CustomersUpdateRequestBody.md +++ b/docs/CustomersUpdateRequestBody.md @@ -8,8 +8,8 @@ | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomersUpdateRequestBodyAddress**](CustomersUpdateRequestBodyAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/CustomersUpdateRequestBodyAddress.md b/docs/CustomersUpdateRequestBodyAddress.md new file mode 100644 index 00000000..8c1a1f2f --- /dev/null +++ b/docs/CustomersUpdateRequestBodyAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersUpdateRequestBodyAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomersUpdateResponseBody.md b/docs/CustomersUpdateResponseBody.md index 10d44a53..a642a328 100644 --- a/docs/CustomersUpdateResponseBody.md +++ b/docs/CustomersUpdateResponseBody.md @@ -6,20 +6,20 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | | **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | -| **summary** | [**CustomerSummary**](CustomerSummary.md) | | | -| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | | -| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | | +| **summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] | +| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] | +| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] | | **system_metadata** | **Object** | Object used to store system metadata information. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the customer was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated in ISO 8601 format. | [optional] | -| **assets** | [**CustomerResponseDataAssets**](CustomerResponseDataAssets.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | +| **created_at** | **Time** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] | +| **assets** | [**CustomersUpdateResponseBodyAssets**](CustomersUpdateResponseBodyAssets.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | | **name** | **String** | Customer's first and last name. | [optional] | | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**CustomersUpdateResponseBodyAddress**](CustomersUpdateResponseBodyAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/CustomersUpdateResponseBodyAddress.md b/docs/CustomersUpdateResponseBodyAddress.md new file mode 100644 index 00000000..672c3d71 --- /dev/null +++ b/docs/CustomersUpdateResponseBodyAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::CustomersUpdateResponseBodyAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/CustomersUpdateResponseBodyAssets.md b/docs/CustomersUpdateResponseBodyAssets.md new file mode 100644 index 00000000..7f0deaa3 --- /dev/null +++ b/docs/CustomersUpdateResponseBodyAssets.md @@ -0,0 +1,8 @@ +# VoucherifySdk::CustomersUpdateResponseBodyAssets + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cockpit_url** | **String** | Customer's cockpit URL address. | [optional] | + diff --git a/docs/Discount.md b/docs/Discount.md index 2bd44e31..6dd7efdc 100644 --- a/docs/Discount.md +++ b/docs/Discount.md @@ -1,55 +1,24 @@ # VoucherifySdk::Discount -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::Discount.openapi_one_of -# => -# [ -# :'DiscountAmount', -# :'DiscountFixed', -# :'DiscountPercent', -# :'DiscountUnit', -# :'DiscountUnitMultiple' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::Discount.build(data) -# => # - -VoucherifySdk::Discount.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `DiscountAmount` -- `DiscountFixed` -- `DiscountPercent` -- `DiscountUnit` -- `DiscountUnitMultiple` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **amount_off** | **Float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] | +| **amount_off_formula** | **String** | | [optional] | +| **aggregated_amount_limit** | **Integer** | Maximum discount amount per order. | [optional] | +| **effect** | **String** | | [optional] | +| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | +| **unit_off** | **Integer** | Number of units to be granted a full value discount. | [optional] | +| **unit_off_formula** | **String** | | [optional] | +| **unit_type** | **String** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] | +| **product** | [**SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] | +| **sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] | +| **units** | [**Array<DiscountUnitMultipleOneUnit>**](DiscountUnitMultipleOneUnit.md) | | [optional] | +| **percent_off** | **Float** | The percent discount that the customer will receive. | [optional] | +| **percent_off_formula** | **String** | | [optional] | +| **amount_limit** | **Float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] | +| **fixed_amount** | **Float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] | +| **fixed_amount_formula** | **String** | | [optional] | diff --git a/docs/DiscountAmount.md b/docs/DiscountAmount.md deleted file mode 100644 index 450e6243..00000000 --- a/docs/DiscountAmount.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::DiscountAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines the type of the voucher. | [default to 'AMOUNT'] | -| **amount_off** | **Float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | | -| **amount_off_formula** | **String** | | [optional] | -| **aggregated_amount_limit** | **Integer** | Maximum discount amount per order. | [optional] | -| **effect** | [**DiscountAmountVouchersEffectTypes**](DiscountAmountVouchersEffectTypes.md) | | [optional] | -| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | - diff --git a/docs/DiscountAmountVouchersEffectTypes.md b/docs/DiscountAmountVouchersEffectTypes.md deleted file mode 100644 index dcc61513..00000000 --- a/docs/DiscountAmountVouchersEffectTypes.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::DiscountAmountVouchersEffectTypes - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/DiscountCouponsCampaignVoucher.md b/docs/DiscountCouponsCampaignVoucher.md deleted file mode 100644 index 444d7dba..00000000 --- a/docs/DiscountCouponsCampaignVoucher.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::DiscountCouponsCampaignVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of voucher. | [default to 'DISCOUNT_VOUCHER'] | -| **discount** | [**Discount**](Discount.md) | | | -| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | -| **redemption** | [**CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] | - diff --git a/docs/DiscountFixed.md b/docs/DiscountFixed.md deleted file mode 100644 index 9db5b6c6..00000000 --- a/docs/DiscountFixed.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::DiscountFixed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines the type of the voucher. | [default to 'FIXED'] | -| **fixed_amount** | **Float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | | -| **fixed_amount_formula** | **String** | | [optional] | -| **effect** | [**DiscountFixedVouchersEffectTypes**](DiscountFixedVouchersEffectTypes.md) | | [optional] | -| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | - diff --git a/docs/DiscountFixedVouchersEffectTypes.md b/docs/DiscountFixedVouchersEffectTypes.md deleted file mode 100644 index 3f2d8cb4..00000000 --- a/docs/DiscountFixedVouchersEffectTypes.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::DiscountFixedVouchersEffectTypes - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/DiscountPercent.md b/docs/DiscountPercent.md deleted file mode 100644 index 33fb17a1..00000000 --- a/docs/DiscountPercent.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::DiscountPercent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines the type of the voucher. | [default to 'PERCENT'] | -| **percent_off** | **Float** | The percent discount that the customer will receive. | | -| **percent_off_formula** | **String** | | [optional] | -| **amount_limit** | **Float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] | -| **aggregated_amount_limit** | **Integer** | Maximum discount amount per order. | [optional] | -| **effect** | [**DiscountPercentVouchersEffectTypes**](DiscountPercentVouchersEffectTypes.md) | | [optional] | -| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | - diff --git a/docs/DiscountPercentVouchersEffectTypes.md b/docs/DiscountPercentVouchersEffectTypes.md deleted file mode 100644 index 89bcf736..00000000 --- a/docs/DiscountPercentVouchersEffectTypes.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::DiscountPercentVouchersEffectTypes - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/DiscountUnit.md b/docs/DiscountUnit.md deleted file mode 100644 index 068c270b..00000000 --- a/docs/DiscountUnit.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::DiscountUnit - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Discount type. | [default to 'UNIT'] | -| **unit_off** | **Integer** | Number of units to be granted a full value discount. | [optional] | -| **unit_off_formula** | **String** | | [optional] | -| **effect** | [**DiscountUnitVouchersEffectTypes**](DiscountUnitVouchersEffectTypes.md) | | [optional] | -| **unit_type** | **String** | The product deemed as free, chosen from product inventory (e.g. time, items). | | -| **product** | [**SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] | -| **sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] | -| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | - diff --git a/docs/DiscountUnitMultiple.md b/docs/DiscountUnitMultiple.md deleted file mode 100644 index 27b0dbe5..00000000 --- a/docs/DiscountUnitMultiple.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::DiscountUnitMultiple - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Discount type. | [default to 'UNIT'] | -| **effect** | **String** | Defines how the discount is applied to the customer's order. | [optional][default to 'ADD_MANY_ITEMS'] | -| **units** | [**Array<DiscountUnitMultipleOneUnit>**](DiscountUnitMultipleOneUnit.md) | | | - diff --git a/docs/DiscountUnitMultipleOneUnit.md b/docs/DiscountUnitMultipleOneUnit.md index c73ead3e..b654af07 100644 --- a/docs/DiscountUnitMultipleOneUnit.md +++ b/docs/DiscountUnitMultipleOneUnit.md @@ -6,8 +6,8 @@ | ---- | ---- | ----------- | ----- | | **unit_off** | **Float** | Number of units to be granted a full value discount. | [optional] | | **unit_off_formula** | **String** | | [optional] | -| **effect** | **String** | Defines how the unit is added to the customer's order. | | -| **unit_type** | **String** | The product deemed as free, chosen from product inventory (e.g. time, items). | | +| **effect** | **String** | Defines how the unit is added to the customer's order. | [optional] | +| **unit_type** | **String** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] | | **product** | [**SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] | | **sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] | diff --git a/docs/DiscountUnitVouchersEffectTypes.md b/docs/DiscountUnitVouchersEffectTypes.md deleted file mode 100644 index 05853d10..00000000 --- a/docs/DiscountUnitVouchersEffectTypes.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::DiscountUnitVouchersEffectTypes - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/EarningRule.md b/docs/EarningRule.md index b1b47d33..de23cb58 100644 --- a/docs/EarningRule.md +++ b/docs/EarningRule.md @@ -4,21 +4,23 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | | -| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. | | -| **loyalty** | [**EarningRuleBaseLoyalty**](EarningRuleBaseLoyalty.md) | | | -| **event** | [**EarningRuleEvent**](EarningRuleEvent.md) | | [optional] | -| **custom_event** | [**EarningRuleBaseCustomEvent**](EarningRuleBaseCustomEvent.md) | | [optional] | -| **segment** | [**EarningRuleBaseSegment**](EarningRuleBaseSegment.md) | | [optional] | -| **source** | [**EarningRuleBaseSource**](EarningRuleBaseSource.md) | | | -| **object** | **String** | The type of object represented by JSON. Default is earning_rule. | [default to 'earning_rule'] | -| **automation_id** | **String** | For internal use by Voucherify. | | -| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | -| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | -| **validity_timeframe** | [**EarningRuleBaseValidityTimeframe**](EarningRuleBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | | -| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | | -| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | | +| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **loyalty** | [**EarningRuleLoyalty**](EarningRuleLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **custom_event** | [**EarningRuleCustomEvent**](EarningRuleCustomEvent.md) | | [optional] | +| **segment** | [**EarningRuleSegment**](EarningRuleSegment.md) | | [optional] | +| **loyalty_tier** | [**EarningRuleLoyaltyTier**](EarningRuleLoyaltyTier.md) | | [optional] | +| **source** | [**EarningRuleSource**](EarningRuleSource.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is earning_rule. | [optional][default to 'earning_rule'] | +| **automation_id** | **String** | For internal use by Voucherify. | [optional] | +| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] | +| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | +| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] | diff --git a/docs/EarningRuleBase.md b/docs/EarningRuleBase.md deleted file mode 100644 index 65180f48..00000000 --- a/docs/EarningRuleBase.md +++ /dev/null @@ -1,21 +0,0 @@ -# VoucherifySdk::EarningRuleBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | | -| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. | | -| **loyalty** | [**EarningRuleBaseLoyalty**](EarningRuleBaseLoyalty.md) | | | -| **event** | [**EarningRuleEvent**](EarningRuleEvent.md) | | [optional] | -| **custom_event** | [**EarningRuleBaseCustomEvent**](EarningRuleBaseCustomEvent.md) | | [optional] | -| **segment** | [**EarningRuleBaseSegment**](EarningRuleBaseSegment.md) | | [optional] | -| **source** | [**EarningRuleBaseSource**](EarningRuleBaseSource.md) | | | -| **object** | **String** | The type of object represented by JSON. Default is earning_rule. | [default to 'earning_rule'] | -| **automation_id** | **String** | For internal use by Voucherify. | | -| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | -| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | -| **validity_timeframe** | [**EarningRuleBaseValidityTimeframe**](EarningRuleBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | | - diff --git a/docs/EarningRuleBaseCustomEvent.md b/docs/EarningRuleBaseCustomEvent.md deleted file mode 100644 index 19617a9b..00000000 --- a/docs/EarningRuleBaseCustomEvent.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleBaseCustomEvent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **schema_id** | **String** | | | - diff --git a/docs/EarningRuleBaseLoyalty.md b/docs/EarningRuleBaseLoyalty.md deleted file mode 100644 index 24149fc4..00000000 --- a/docs/EarningRuleBaseLoyalty.md +++ /dev/null @@ -1,49 +0,0 @@ -# VoucherifySdk::EarningRuleBaseLoyalty - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleBaseLoyalty.openapi_one_of -# => -# [ -# :'EarningRuleFixed', -# :'EarningRuleProportional' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleBaseLoyalty.build(data) -# => # - -VoucherifySdk::EarningRuleBaseLoyalty.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `EarningRuleFixed` -- `EarningRuleProportional` -- `nil` (if no type matches) - diff --git a/docs/EarningRuleBaseSegment.md b/docs/EarningRuleBaseSegment.md deleted file mode 100644 index 6287d6f8..00000000 --- a/docs/EarningRuleBaseSegment.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleBaseSegment - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | | - diff --git a/docs/EarningRuleBaseSource.md b/docs/EarningRuleBaseSource.md deleted file mode 100644 index 36907030..00000000 --- a/docs/EarningRuleBaseSource.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleBaseSource - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | -| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | | -| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [default to 'campaign'] | - diff --git a/docs/EarningRuleBaseValidityTimeframe.md b/docs/EarningRuleBaseValidityTimeframe.md deleted file mode 100644 index cc74e116..00000000 --- a/docs/EarningRuleBaseValidityTimeframe.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EarningRuleBaseValidityTimeframe - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **duration** | **String** | Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour. | | -| **interval** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day. | | - diff --git a/docs/EarningRuleCustomEvent.md b/docs/EarningRuleCustomEvent.md new file mode 100644 index 00000000..f64b465a --- /dev/null +++ b/docs/EarningRuleCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::EarningRuleCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Unique identifier of the custom event schema | [optional] | + diff --git a/docs/EarningRuleEvent.md b/docs/EarningRuleEvent.md deleted file mode 100644 index eabe317c..00000000 --- a/docs/EarningRuleEvent.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::EarningRuleEvent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/EarningRuleFixed.md b/docs/EarningRuleFixed.md deleted file mode 100644 index 52cb7a39..00000000 --- a/docs/EarningRuleFixed.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EarningRuleFixed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | The number of points to be added to the loyalty card. | [optional][default to 'FIXED'] | -| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | - diff --git a/docs/EarningRuleLoyalty.md b/docs/EarningRuleLoyalty.md new file mode 100644 index 00000000..275c1282 --- /dev/null +++ b/docs/EarningRuleLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::EarningRuleLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**EarningRuleLoyaltyOrder**](EarningRuleLoyaltyOrder.md) | | [optional] | +| **order_items** | [**EarningRuleLoyaltyOrderItems**](EarningRuleLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**EarningRuleLoyaltyCustomer**](EarningRuleLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**EarningRuleLoyaltyCustomEvent**](EarningRuleLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/EarningRuleLoyaltyCustomEvent.md b/docs/EarningRuleLoyaltyCustomEvent.md new file mode 100644 index 00000000..536c810b --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::EarningRuleLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**EarningRuleLoyaltyCustomEventMetadata**](EarningRuleLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/EarningRuleLoyaltyCustomEventMetadata.md b/docs/EarningRuleLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..9560d2c1 --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::EarningRuleLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/EarningRuleLoyaltyCustomer.md b/docs/EarningRuleLoyaltyCustomer.md new file mode 100644 index 00000000..bfefd82e --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::EarningRuleLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**EarningRuleLoyaltyCustomerMetadata**](EarningRuleLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/EarningRuleLoyaltyCustomerMetadata.md b/docs/EarningRuleLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..710bf622 --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::EarningRuleLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrder.md b/docs/EarningRuleLoyaltyOrder.md new file mode 100644 index 00000000..06a65370 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::EarningRuleLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**EarningRuleLoyaltyOrderAmount**](EarningRuleLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**EarningRuleLoyaltyOrderTotalAmount**](EarningRuleLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**EarningRuleLoyaltyOrderMetadata**](EarningRuleLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderAmount.md b/docs/EarningRuleLoyaltyOrderAmount.md new file mode 100644 index 00000000..34fc90ce --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderItems.md b/docs/EarningRuleLoyaltyOrderItems.md new file mode 100644 index 00000000..ae5a8a6d --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**EarningRuleLoyaltyOrderItemsQuantity**](EarningRuleLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**EarningRuleLoyaltyOrderItemsAmount**](EarningRuleLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**EarningRuleLoyaltyOrderItemsSubtotalAmount**](EarningRuleLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderItemsAmount.md b/docs/EarningRuleLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..571d03dc --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderItemsQuantity.md b/docs/EarningRuleLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..e09e2143 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md b/docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..0a3bba7a --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderMetadata.md b/docs/EarningRuleLoyaltyOrderMetadata.md new file mode 100644 index 00000000..2d069508 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/EarningRuleLoyaltyOrderTotalAmount.md b/docs/EarningRuleLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..9dfed735 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::EarningRuleLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/EarningRuleLoyaltyTier.md b/docs/EarningRuleLoyaltyTier.md new file mode 100644 index 00000000..4f5d00a5 --- /dev/null +++ b/docs/EarningRuleLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::EarningRuleLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/EarningRuleProportional.md b/docs/EarningRuleProportional.md deleted file mode 100644 index 3a78cbb8..00000000 --- a/docs/EarningRuleProportional.md +++ /dev/null @@ -1,53 +0,0 @@ -# VoucherifySdk::EarningRuleProportional - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleProportional.openapi_one_of -# => -# [ -# :'EarningRuleProportionalCustomEvent', -# :'EarningRuleProportionalCustomerMetadata', -# :'EarningRuleProportionalOrder', -# :'EarningRuleProportionalOrderItems' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleProportional.build(data) -# => # - -VoucherifySdk::EarningRuleProportional.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `EarningRuleProportionalCustomEvent` -- `EarningRuleProportionalCustomerMetadata` -- `EarningRuleProportionalOrder` -- `EarningRuleProportionalOrderItems` -- `nil` (if no type matches) - diff --git a/docs/EarningRuleProportionalCustomEvent.md b/docs/EarningRuleProportionalCustomEvent.md deleted file mode 100644 index b2570b4a..00000000 --- a/docs/EarningRuleProportionalCustomEvent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalCustomEvent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute). | [default to 'CUSTOM_EVENT_METADATA'] | -| **custom_event** | [**EarningRuleProportionalCustomEventCustomEvent**](EarningRuleProportionalCustomEventCustomEvent.md) | | | - diff --git a/docs/EarningRuleProportionalCustomEventCustomEvent.md b/docs/EarningRuleProportionalCustomEventCustomEvent.md deleted file mode 100644 index 51ad1f1b..00000000 --- a/docs/EarningRuleProportionalCustomEventCustomEvent.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalCustomEventCustomEvent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **metadata** | [**EarningRuleProportionalCustomEventCustomEventMetadata**](EarningRuleProportionalCustomEventCustomEventMetadata.md) | | | - diff --git a/docs/EarningRuleProportionalCustomEventCustomEventMetadata.md b/docs/EarningRuleProportionalCustomEventCustomEventMetadata.md deleted file mode 100644 index b3fc786a..00000000 --- a/docs/EarningRuleProportionalCustomEventCustomEventMetadata.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalCustomEventCustomEventMetadata - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | | -| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | | -| **property** | **String** | Custom event metadata property. | | - diff --git a/docs/EarningRuleProportionalCustomerMetadata.md b/docs/EarningRuleProportionalCustomerMetadata.md deleted file mode 100644 index 7d8a3355..00000000 --- a/docs/EarningRuleProportionalCustomerMetadata.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalCustomerMetadata - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object) | [default to 'CUSTOMER_METADATA'] | -| **customer** | [**EarningRuleProportionalCustomerMetadataCustomer**](EarningRuleProportionalCustomerMetadataCustomer.md) | | | - diff --git a/docs/EarningRuleProportionalCustomerMetadataCustomer.md b/docs/EarningRuleProportionalCustomerMetadataCustomer.md deleted file mode 100644 index 074e5632..00000000 --- a/docs/EarningRuleProportionalCustomerMetadataCustomer.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomer - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **metadata** | [**EarningRuleProportionalCustomerMetadataCustomerMetadata**](EarningRuleProportionalCustomerMetadataCustomerMetadata.md) | | | - diff --git a/docs/EarningRuleProportionalCustomerMetadataCustomerMetadata.md b/docs/EarningRuleProportionalCustomerMetadataCustomerMetadata.md deleted file mode 100644 index 4dcdbe68..00000000 --- a/docs/EarningRuleProportionalCustomerMetadataCustomerMetadata.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomerMetadata - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | | -| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | | -| **property** | **String** | Customer metadata property. | | - diff --git a/docs/EarningRuleProportionalOrder.md b/docs/EarningRuleProportionalOrder.md deleted file mode 100644 index b78118b8..00000000 --- a/docs/EarningRuleProportionalOrder.md +++ /dev/null @@ -1,51 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrder - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleProportionalOrder.openapi_one_of -# => -# [ -# :'EarningRuleProportionalOrderAmount', -# :'EarningRuleProportionalOrderMetadata', -# :'EarningRuleProportionalOrderTotalAmount' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleProportionalOrder.build(data) -# => # - -VoucherifySdk::EarningRuleProportionalOrder.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `EarningRuleProportionalOrderAmount` -- `EarningRuleProportionalOrderMetadata` -- `EarningRuleProportionalOrderTotalAmount` -- `nil` (if no type matches) - diff --git a/docs/EarningRuleProportionalOrderAmount.md b/docs/EarningRuleProportionalOrderAmount.md deleted file mode 100644 index fc9b0665..00000000 --- a/docs/EarningRuleProportionalOrderAmount.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | `ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts) | [default to 'ORDER_AMOUNT'] | -| **order** | [**EarningRuleProportionalOrderAmountOrder**](EarningRuleProportionalOrderAmountOrder.md) | | | - diff --git a/docs/EarningRuleProportionalOrderAmountOrder.md b/docs/EarningRuleProportionalOrderAmountOrder.md deleted file mode 100644 index c68fc7f6..00000000 --- a/docs/EarningRuleProportionalOrderAmountOrder.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderAmountOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **amount** | [**EarningRuleProportionalOrderAmountOrderAmount**](EarningRuleProportionalOrderAmountOrderAmount.md) | | | - diff --git a/docs/EarningRuleProportionalOrderAmountOrderAmount.md b/docs/EarningRuleProportionalOrderAmountOrderAmount.md deleted file mode 100644 index 2443509b..00000000 --- a/docs/EarningRuleProportionalOrderAmountOrderAmount.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderAmountOrderAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | | -| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | | - diff --git a/docs/EarningRuleProportionalOrderItems.md b/docs/EarningRuleProportionalOrderItems.md deleted file mode 100644 index fb9a1eaa..00000000 --- a/docs/EarningRuleProportionalOrderItems.md +++ /dev/null @@ -1,51 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItems - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleProportionalOrderItems.openapi_one_of -# => -# [ -# :'EarningRuleProportionalOrderItemsAmount', -# :'EarningRuleProportionalOrderItemsQuantity', -# :'EarningRuleProportionalOrderItemsSubtotalAmount' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::EarningRuleProportionalOrderItems.build(data) -# => # - -VoucherifySdk::EarningRuleProportionalOrderItems.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `EarningRuleProportionalOrderItemsAmount` -- `EarningRuleProportionalOrderItemsQuantity` -- `EarningRuleProportionalOrderItemsSubtotalAmount` -- `nil` (if no type matches) - diff --git a/docs/EarningRuleProportionalOrderItemsAmount.md b/docs/EarningRuleProportionalOrderItemsAmount.md deleted file mode 100644 index 267651f3..00000000 --- a/docs/EarningRuleProportionalOrderItemsAmount.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts) | [default to 'ORDER_ITEMS_AMOUNT'] | -| **order_items** | [**EarningRuleProportionalOrderItemsAmountOrderItems**](EarningRuleProportionalOrderItemsAmountOrderItems.md) | | | - diff --git a/docs/EarningRuleProportionalOrderItemsAmountOrderItems.md b/docs/EarningRuleProportionalOrderItemsAmountOrderItems.md deleted file mode 100644 index 8847c249..00000000 --- a/docs/EarningRuleProportionalOrderItemsAmountOrderItems.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItems - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **amount** | [**EarningRuleProportionalOrderItemsAmountOrderItemsAmount**](EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md) | | | - diff --git a/docs/EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md b/docs/EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md deleted file mode 100644 index 96d13b1a..00000000 --- a/docs/EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItemsAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | | -| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | | -| **object** | **String** | Type of object taken under consideration. | | -| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | | - diff --git a/docs/EarningRuleProportionalOrderItemsQuantity.md b/docs/EarningRuleProportionalOrderItemsQuantity.md deleted file mode 100644 index ccd7bca9..00000000 --- a/docs/EarningRuleProportionalOrderItemsQuantity.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsQuantity - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | `ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items) | [default to 'ORDER_ITEMS_QUANTITY'] | -| **order_items** | [**EarningRuleProportionalOrderItemsQuantityOrderItems**](EarningRuleProportionalOrderItemsQuantityOrderItems.md) | | | - diff --git a/docs/EarningRuleProportionalOrderItemsQuantityOrderItems.md b/docs/EarningRuleProportionalOrderItemsQuantityOrderItems.md deleted file mode 100644 index 9d60b703..00000000 --- a/docs/EarningRuleProportionalOrderItemsQuantityOrderItems.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsQuantityOrderItems - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **quantity** | [**EarningRuleProportionalOrderItemsAmountOrderItemsAmount**](EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md) | | | - diff --git a/docs/EarningRuleProportionalOrderItemsSubtotalAmount.md b/docs/EarningRuleProportionalOrderItemsSubtotalAmount.md deleted file mode 100644 index 2aeee3cf..00000000 --- a/docs/EarningRuleProportionalOrderItemsSubtotalAmount.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts) | [default to 'ORDER_ITEMS_SUBTOTAL_AMOUNT'] | -| **order_items** | [**EarningRuleProportionalOrderItemsSubtotalAmountOrderItems**](EarningRuleProportionalOrderItemsSubtotalAmountOrderItems.md) | | | - diff --git a/docs/EarningRuleProportionalOrderItemsSubtotalAmountOrderItems.md b/docs/EarningRuleProportionalOrderItemsSubtotalAmountOrderItems.md deleted file mode 100644 index 4292dc10..00000000 --- a/docs/EarningRuleProportionalOrderItemsSubtotalAmountOrderItems.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmountOrderItems - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **subtotal_amount** | [**EarningRuleProportionalOrderItemsAmountOrderItemsAmount**](EarningRuleProportionalOrderItemsAmountOrderItemsAmount.md) | | | - diff --git a/docs/EarningRuleProportionalOrderMetadata.md b/docs/EarningRuleProportionalOrderMetadata.md deleted file mode 100644 index 10959abd..00000000 --- a/docs/EarningRuleProportionalOrderMetadata.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderMetadata - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | `ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object) | [default to 'ORDER_METADATA'] | -| **order** | [**EarningRuleProportionalOrderMetadataOrder**](EarningRuleProportionalOrderMetadataOrder.md) | | | - diff --git a/docs/EarningRuleProportionalOrderMetadataOrder.md b/docs/EarningRuleProportionalOrderMetadataOrder.md deleted file mode 100644 index e6c3019d..00000000 --- a/docs/EarningRuleProportionalOrderMetadataOrder.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderMetadataOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **metadata** | [**EarningRuleProportionalOrderMetadataOrderMetadata**](EarningRuleProportionalOrderMetadataOrderMetadata.md) | | | - diff --git a/docs/EarningRuleProportionalOrderMetadataOrderMetadata.md b/docs/EarningRuleProportionalOrderMetadataOrderMetadata.md deleted file mode 100644 index 618e3762..00000000 --- a/docs/EarningRuleProportionalOrderMetadataOrderMetadata.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderMetadataOrderMetadata - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | | -| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | | -| **property** | **String** | Order metadata property. | | - diff --git a/docs/EarningRuleProportionalOrderTotalAmount.md b/docs/EarningRuleProportionalOrderTotalAmount.md deleted file mode 100644 index b9f1952c..00000000 --- a/docs/EarningRuleProportionalOrderTotalAmount.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderTotalAmount - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. | [default to 'PROPORTIONAL'] | -| **calculation_type** | **String** | `ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount) | [default to 'ORDER_TOTAL_AMOUNT'] | -| **order** | [**EarningRuleProportionalOrderTotalAmountOrder**](EarningRuleProportionalOrderTotalAmountOrder.md) | | | - diff --git a/docs/EarningRuleProportionalOrderTotalAmountOrder.md b/docs/EarningRuleProportionalOrderTotalAmountOrder.md deleted file mode 100644 index 47fa9591..00000000 --- a/docs/EarningRuleProportionalOrderTotalAmountOrder.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EarningRuleProportionalOrderTotalAmountOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **total_amount** | [**EarningRuleProportionalOrderAmountOrderAmount**](EarningRuleProportionalOrderAmountOrderAmount.md) | | | - diff --git a/docs/EarningRuleSegment.md b/docs/EarningRuleSegment.md new file mode 100644 index 00000000..33958bba --- /dev/null +++ b/docs/EarningRuleSegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::EarningRuleSegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/EarningRuleSource.md b/docs/EarningRuleSource.md new file mode 100644 index 00000000..842daa2f --- /dev/null +++ b/docs/EarningRuleSource.md @@ -0,0 +1,10 @@ +# VoucherifySdk::EarningRuleSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | +| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | [optional] | +| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional][default to 'campaign'] | + diff --git a/docs/Error.md b/docs/Error.md index 5eb5ac24..f7d777d9 100644 --- a/docs/Error.md +++ b/docs/Error.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **Integer** | Error's HTTP status code. | | -| **key** | **String** | Short string describing the kind of error which occurred. | | -| **message** | **String** | A human-readable message providing a short description about the error. | | -| **details** | **String** | A human-readable message providing more details about the error. | | -| **request_id** | **String** | This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team. | | +| **code** | **Integer** | Error's HTTP status code. | [optional] | +| **key** | **String** | Short string describing the kind of error which occurred. | [optional] | +| **message** | **String** | A human-readable message providing a short description about the error. | [optional] | +| **details** | **String** | A human-readable message providing more details about the error. | [optional] | +| **request_id** | **String** | This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team. | [optional] | | **resource_id** | **String** | Unique resource ID that can be used in another endpoint to get more details. | [optional] | | **resource_type** | **String** | The resource type. | [optional] | diff --git a/docs/EventCustomerActiveCampaignFailed.md b/docs/EventCustomerActiveCampaignFailed.md deleted file mode 100644 index 96579b38..00000000 --- a/docs/EventCustomerActiveCampaignFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerActiveCampaignFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerActiveCampaignRecovered.md b/docs/EventCustomerActiveCampaignRecovered.md deleted file mode 100644 index 18bbfc80..00000000 --- a/docs/EventCustomerActiveCampaignRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerActiveCampaignRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerActiveCampaignSent.md b/docs/EventCustomerActiveCampaignSent.md deleted file mode 100644 index 1eafe7dd..00000000 --- a/docs/EventCustomerActiveCampaignSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerActiveCampaignSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerBatchFailed.md b/docs/EventCustomerBatchFailed.md deleted file mode 100644 index ae2d0623..00000000 --- a/docs/EventCustomerBatchFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerBatchFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerBatchRecovered.md b/docs/EventCustomerBatchRecovered.md deleted file mode 100644 index 97db31e7..00000000 --- a/docs/EventCustomerBatchRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerBatchRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerBatchSent.md b/docs/EventCustomerBatchSent.md deleted file mode 100644 index 1dc588ed..00000000 --- a/docs/EventCustomerBatchSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerBatchSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerBrazeFailed.md b/docs/EventCustomerBrazeFailed.md deleted file mode 100644 index 69d3c027..00000000 --- a/docs/EventCustomerBrazeFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerBrazeFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerBrazeRecovered.md b/docs/EventCustomerBrazeRecovered.md deleted file mode 100644 index 266d16ca..00000000 --- a/docs/EventCustomerBrazeRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerBrazeRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerBrazeSent.md b/docs/EventCustomerBrazeSent.md deleted file mode 100644 index d8e80207..00000000 --- a/docs/EventCustomerBrazeSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerBrazeSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerConfirmed.md b/docs/EventCustomerConfirmed.md deleted file mode 100644 index 51822790..00000000 --- a/docs/EventCustomerConfirmed.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerConfirmed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] | -| **unconfirmed_customer** | [**EventCustomerConfirmedUnconfirmedCustomer**](EventCustomerConfirmedUnconfirmedCustomer.md) | | [optional] | - diff --git a/docs/EventCustomerConfirmedUnconfirmedCustomer.md b/docs/EventCustomerConfirmedUnconfirmedCustomer.md deleted file mode 100644 index 110223cf..00000000 --- a/docs/EventCustomerConfirmedUnconfirmedCustomer.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EventCustomerConfirmedUnconfirmedCustomer - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | | [optional] | - diff --git a/docs/EventCustomerConsents.md b/docs/EventCustomerConsents.md deleted file mode 100644 index df874dd7..00000000 --- a/docs/EventCustomerConsents.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerConsents - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **consents** | [**Array<SimpleConsent>**](SimpleConsent.md) | | [optional] | - diff --git a/docs/EventCustomerConsentsGiven.md b/docs/EventCustomerConsentsGiven.md deleted file mode 100644 index 96a0d006..00000000 --- a/docs/EventCustomerConsentsGiven.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerConsentsGiven - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **consents** | [**Array<SimpleConsent>**](SimpleConsent.md) | | [optional] | - diff --git a/docs/EventCustomerConsentsRevoked.md b/docs/EventCustomerConsentsRevoked.md deleted file mode 100644 index 7c1833d5..00000000 --- a/docs/EventCustomerConsentsRevoked.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerConsentsRevoked - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **consents** | [**Array<SimpleConsent>**](SimpleConsent.md) | | [optional] | - diff --git a/docs/EventCustomerCreated.md b/docs/EventCustomerCreated.md deleted file mode 100644 index d9fb3416..00000000 --- a/docs/EventCustomerCreated.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EventCustomerCreated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] | - diff --git a/docs/EventCustomerCustomEvent.md b/docs/EventCustomerCustomEvent.md deleted file mode 100644 index 1769fd85..00000000 --- a/docs/EventCustomerCustomEvent.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EventCustomerCustomEvent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | - diff --git a/docs/EventCustomerDeleted.md b/docs/EventCustomerDeleted.md deleted file mode 100644 index b2829f87..00000000 --- a/docs/EventCustomerDeleted.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EventCustomerDeleted - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] | - diff --git a/docs/EventCustomerEmailFailed.md b/docs/EventCustomerEmailFailed.md deleted file mode 100644 index f3ca13f3..00000000 --- a/docs/EventCustomerEmailFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerEmailFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerEmailRecovered.md b/docs/EventCustomerEmailRecovered.md deleted file mode 100644 index d3bace14..00000000 --- a/docs/EventCustomerEmailRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerEmailRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerEmailSent.md b/docs/EventCustomerEmailSent.md deleted file mode 100644 index 3f82c9b0..00000000 --- a/docs/EventCustomerEmailSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerEmailSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerFailed.md b/docs/EventCustomerFailed.md deleted file mode 100644 index 2d2f4abd..00000000 --- a/docs/EventCustomerFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerGiftVoucherBalanceAdded.md b/docs/EventCustomerGiftVoucherBalanceAdded.md deleted file mode 100644 index e3b1e006..00000000 --- a/docs/EventCustomerGiftVoucherBalanceAdded.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::EventCustomerGiftVoucherBalanceAdded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **balance** | **Integer** | | [optional] | -| **transaction** | [**VoucherTransaction**](VoucherTransaction.md) | | [optional] | - diff --git a/docs/EventCustomerIntercomFailed.md b/docs/EventCustomerIntercomFailed.md deleted file mode 100644 index 7aa08d30..00000000 --- a/docs/EventCustomerIntercomFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerIntercomFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerIntercomRecovered.md b/docs/EventCustomerIntercomRecovered.md deleted file mode 100644 index b0d67989..00000000 --- a/docs/EventCustomerIntercomRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerIntercomRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerIntercomSent.md b/docs/EventCustomerIntercomSent.md deleted file mode 100644 index 97960b8d..00000000 --- a/docs/EventCustomerIntercomSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerIntercomSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerKlaviyoFailed.md b/docs/EventCustomerKlaviyoFailed.md deleted file mode 100644 index e98de7ad..00000000 --- a/docs/EventCustomerKlaviyoFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerKlaviyoFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerKlaviyoRecovered.md b/docs/EventCustomerKlaviyoRecovered.md deleted file mode 100644 index d6dbd02f..00000000 --- a/docs/EventCustomerKlaviyoRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerKlaviyoRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerKlaviyoSent.md b/docs/EventCustomerKlaviyoSent.md deleted file mode 100644 index 6d9342c2..00000000 --- a/docs/EventCustomerKlaviyoSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerKlaviyoSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerLoyaltyCardPointsAdded.md b/docs/EventCustomerLoyaltyCardPointsAdded.md deleted file mode 100644 index 7590039e..00000000 --- a/docs/EventCustomerLoyaltyCardPointsAdded.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyCardPointsAdded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **balance** | **Integer** | | [optional] | -| **transaction** | [**VoucherTransaction**](VoucherTransaction.md) | | [optional] | - diff --git a/docs/EventCustomerLoyaltyCardPointsTransferred.md b/docs/EventCustomerLoyaltyCardPointsTransferred.md deleted file mode 100644 index 299993ae..00000000 --- a/docs/EventCustomerLoyaltyCardPointsTransferred.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyCardPointsTransferred - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **source_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **destination_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **balance** | **Integer** | | [optional] | -| **transaction** | [**VoucherTransaction**](VoucherTransaction.md) | | [optional] | - diff --git a/docs/EventCustomerLoyaltyTierBase.md b/docs/EventCustomerLoyaltyTierBase.md deleted file mode 100644 index 0976cdc7..00000000 --- a/docs/EventCustomerLoyaltyTierBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | - diff --git a/docs/EventCustomerLoyaltyTierDowngraded.md b/docs/EventCustomerLoyaltyTierDowngraded.md deleted file mode 100644 index 3fa6920c..00000000 --- a/docs/EventCustomerLoyaltyTierDowngraded.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierDowngraded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier_from** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **loyalty_tier_to** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **created_at** | **Time** | | | - diff --git a/docs/EventCustomerLoyaltyTierExpirationChanged.md b/docs/EventCustomerLoyaltyTierExpirationChanged.md deleted file mode 100644 index ced9c97d..00000000 --- a/docs/EventCustomerLoyaltyTierExpirationChanged.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierExpirationChanged - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **created_at** | **Time** | | | -| **expiration_date** | **Time** | | | - diff --git a/docs/EventCustomerLoyaltyTierJoined.md b/docs/EventCustomerLoyaltyTierJoined.md deleted file mode 100644 index f561331f..00000000 --- a/docs/EventCustomerLoyaltyTierJoined.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierJoined - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **created_at** | **Time** | | | - diff --git a/docs/EventCustomerLoyaltyTierLeft.md b/docs/EventCustomerLoyaltyTierLeft.md deleted file mode 100644 index 7fa7e84e..00000000 --- a/docs/EventCustomerLoyaltyTierLeft.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierLeft - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **created_at** | **Time** | | | - diff --git a/docs/EventCustomerLoyaltyTierProlonged.md b/docs/EventCustomerLoyaltyTierProlonged.md deleted file mode 100644 index ac56ba91..00000000 --- a/docs/EventCustomerLoyaltyTierProlonged.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierProlonged - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **created_at** | **Time** | | | - diff --git a/docs/EventCustomerLoyaltyTierUpgraded.md b/docs/EventCustomerLoyaltyTierUpgraded.md deleted file mode 100644 index 33daa77a..00000000 --- a/docs/EventCustomerLoyaltyTierUpgraded.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyTierUpgraded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier_from** | [**LoyaltyTier**](LoyaltyTier.md) | | [optional] | -| **loyalty_tier_to** | [**LoyaltyTier**](LoyaltyTier.md) | | | -| **created_at** | **Time** | | | - diff --git a/docs/EventCustomerLoyaltyUpdated.md b/docs/EventCustomerLoyaltyUpdated.md deleted file mode 100644 index ffdae02b..00000000 --- a/docs/EventCustomerLoyaltyUpdated.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerLoyaltyUpdated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty** | **Object** | | [optional] | -| **created_at** | **Time** | | | - diff --git a/docs/EventCustomerMailchimpFailed.md b/docs/EventCustomerMailchimpFailed.md deleted file mode 100644 index 3e6d451a..00000000 --- a/docs/EventCustomerMailchimpFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerMailchimpFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerMailchimpRecovered.md b/docs/EventCustomerMailchimpRecovered.md deleted file mode 100644 index 71824d93..00000000 --- a/docs/EventCustomerMailchimpRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerMailchimpRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerMailchimpSent.md b/docs/EventCustomerMailchimpSent.md deleted file mode 100644 index 916135c9..00000000 --- a/docs/EventCustomerMailchimpSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerMailchimpSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerOrder.md b/docs/EventCustomerOrder.md deleted file mode 100644 index 339b03ad..00000000 --- a/docs/EventCustomerOrder.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerOrderCanceled.md b/docs/EventCustomerOrderCanceled.md deleted file mode 100644 index f3cc037c..00000000 --- a/docs/EventCustomerOrderCanceled.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrderCanceled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerOrderCreated.md b/docs/EventCustomerOrderCreated.md deleted file mode 100644 index 27896e17..00000000 --- a/docs/EventCustomerOrderCreated.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrderCreated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerOrderFulfilled.md b/docs/EventCustomerOrderFulfilled.md deleted file mode 100644 index f35d7c6d..00000000 --- a/docs/EventCustomerOrderFulfilled.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrderFulfilled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerOrderPaid.md b/docs/EventCustomerOrderPaid.md deleted file mode 100644 index bccba28c..00000000 --- a/docs/EventCustomerOrderPaid.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrderPaid - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerOrderProcessing.md b/docs/EventCustomerOrderProcessing.md deleted file mode 100644 index b5cdbc80..00000000 --- a/docs/EventCustomerOrderProcessing.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrderProcessing - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerOrderUpdated.md b/docs/EventCustomerOrderUpdated.md deleted file mode 100644 index 0d97d514..00000000 --- a/docs/EventCustomerOrderUpdated.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::EventCustomerOrderUpdated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerPublicationFailed.md b/docs/EventCustomerPublicationFailed.md deleted file mode 100644 index 097a534f..00000000 --- a/docs/EventCustomerPublicationFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerPublicationFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **publication** | **Object** | | [optional] | - diff --git a/docs/EventCustomerPublicationSucceeded.md b/docs/EventCustomerPublicationSucceeded.md deleted file mode 100644 index 3be0c404..00000000 --- a/docs/EventCustomerPublicationSucceeded.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerPublicationSucceeded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **publication** | **Object** | | [optional] | - diff --git a/docs/EventCustomerRecovered.md b/docs/EventCustomerRecovered.md deleted file mode 100644 index f19486fd..00000000 --- a/docs/EventCustomerRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerRedemption.md b/docs/EventCustomerRedemption.md deleted file mode 100644 index 113289d3..00000000 --- a/docs/EventCustomerRedemption.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::EventCustomerRedemption - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**SimpleOrder**](SimpleOrder.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **promotion_tier** | [**SimplePromotionTier**](SimplePromotionTier.md) | | [optional] | -| **redemption** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | - diff --git a/docs/EventCustomerRedemptionFailed.md b/docs/EventCustomerRedemptionFailed.md deleted file mode 100644 index 02905ebd..00000000 --- a/docs/EventCustomerRedemptionFailed.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::EventCustomerRedemptionFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**SimpleOrder**](SimpleOrder.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **promotion_tier** | [**SimplePromotionTier**](SimplePromotionTier.md) | | [optional] | -| **redemption** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | - diff --git a/docs/EventCustomerRedemptionRollbackFailed.md b/docs/EventCustomerRedemptionRollbackFailed.md deleted file mode 100644 index 086b24ac..00000000 --- a/docs/EventCustomerRedemptionRollbackFailed.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::EventCustomerRedemptionRollbackFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**SimpleOrder**](SimpleOrder.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **promotion_tier** | [**SimplePromotionTier**](SimplePromotionTier.md) | | [optional] | -| **redemption** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | -| **redemption_rollback** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | - diff --git a/docs/EventCustomerRedemptionRollbackSucceeded.md b/docs/EventCustomerRedemptionRollbackSucceeded.md deleted file mode 100644 index 4b846f4a..00000000 --- a/docs/EventCustomerRedemptionRollbackSucceeded.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::EventCustomerRedemptionRollbackSucceeded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**SimpleOrder**](SimpleOrder.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **promotion_tier** | [**SimplePromotionTier**](SimplePromotionTier.md) | | [optional] | -| **redemption** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | -| **redemption_rollback** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | - diff --git a/docs/EventCustomerRedemptionSucceeded.md b/docs/EventCustomerRedemptionSucceeded.md deleted file mode 100644 index 8604d304..00000000 --- a/docs/EventCustomerRedemptionSucceeded.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::EventCustomerRedemptionSucceeded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **order** | [**SimpleOrder**](SimpleOrder.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **promotion_tier** | [**SimplePromotionTier**](SimplePromotionTier.md) | | [optional] | -| **redemption** | [**SimpleRedemption**](SimpleRedemption.md) | | [optional] | - diff --git a/docs/EventCustomerReferred.md b/docs/EventCustomerReferred.md deleted file mode 100644 index e142284e..00000000 --- a/docs/EventCustomerReferred.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::EventCustomerReferred - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **referrer** | [**SimpleCustomer**](SimpleCustomer.md) | | | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | | -| **custom_event** | [**CustomEvent**](CustomEvent.md) | | | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | - diff --git a/docs/EventCustomerRewardRedemptions.md b/docs/EventCustomerRewardRedemptions.md deleted file mode 100644 index efb89dfb..00000000 --- a/docs/EventCustomerRewardRedemptions.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::EventCustomerRewardRedemptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **reward_redemption** | **Object** | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **reward_assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] | -| **source** | **String** | | [optional] | -| **balance** | **Integer** | | [optional] | - diff --git a/docs/EventCustomerRewardRedemptionsCompleted.md b/docs/EventCustomerRewardRedemptionsCompleted.md deleted file mode 100644 index f9062cea..00000000 --- a/docs/EventCustomerRewardRedemptionsCompleted.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::EventCustomerRewardRedemptionsCompleted - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **reward_redemption** | **Object** | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **reward_assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] | -| **source** | **String** | | [optional] | -| **balance** | **Integer** | | [optional] | - diff --git a/docs/EventCustomerRewardRedemptionsCreated.md b/docs/EventCustomerRewardRedemptionsCreated.md deleted file mode 100644 index 08f6fb6e..00000000 --- a/docs/EventCustomerRewardRedemptionsCreated.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::EventCustomerRewardRedemptionsCreated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **reward_redemption** | **Object** | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **reward_assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] | -| **source** | **String** | | [optional] | -| **balance** | **Integer** | | [optional] | - diff --git a/docs/EventCustomerRewardRedemptionsPending.md b/docs/EventCustomerRewardRedemptionsPending.md deleted file mode 100644 index e24df81e..00000000 --- a/docs/EventCustomerRewardRedemptionsPending.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::EventCustomerRewardRedemptionsPending - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **reward_redemption** | **Object** | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **reward_assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] | -| **source** | **String** | | [optional] | -| **balance** | **Integer** | | [optional] | - diff --git a/docs/EventCustomerRewardRedemptionsRolledBack.md b/docs/EventCustomerRewardRedemptionsRolledBack.md deleted file mode 100644 index 60b393f8..00000000 --- a/docs/EventCustomerRewardRedemptionsRolledBack.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::EventCustomerRewardRedemptionsRolledBack - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **reward_redemption** | **Object** | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **reward_assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] | -| **source** | **String** | | [optional] | -| **balance** | **Integer** | | [optional] | - diff --git a/docs/EventCustomerRewarded.md b/docs/EventCustomerRewarded.md deleted file mode 100644 index 693ccae0..00000000 --- a/docs/EventCustomerRewarded.md +++ /dev/null @@ -1,17 +0,0 @@ -# VoucherifySdk::EventCustomerRewarded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **redemption** | [**RedemptionInternal**](RedemptionInternal.md) | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **referral_tier** | [**SimpleReferralTier**](SimpleReferralTier.md) | | [optional] | -| **balance** | **Integer** | | [optional] | -| **custom_event** | [**CustomEvent**](CustomEvent.md) | | [optional] | -| **customer_event** | **Object** | | [optional] | - diff --git a/docs/EventCustomerRewardedLoyaltyPoints.md b/docs/EventCustomerRewardedLoyaltyPoints.md deleted file mode 100644 index 7dc4bb63..00000000 --- a/docs/EventCustomerRewardedLoyaltyPoints.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::EventCustomerRewardedLoyaltyPoints - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **loyalty_tier** | [**LoyaltyTier**](LoyaltyTier.md) | | [optional] | -| **earning_rule** | [**EarningRule**](EarningRule.md) | | [optional] | -| **balance** | **Integer** | | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **event** | **Object** | | [optional] | - diff --git a/docs/EventCustomerSegmentEntered.md b/docs/EventCustomerSegmentEntered.md deleted file mode 100644 index a91663ba..00000000 --- a/docs/EventCustomerSegmentEntered.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerSegmentEntered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **segment** | [**SimpleSegment**](SimpleSegment.md) | | | - diff --git a/docs/EventCustomerSegmentLeft.md b/docs/EventCustomerSegmentLeft.md deleted file mode 100644 index 18fb1fd7..00000000 --- a/docs/EventCustomerSegmentLeft.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerSegmentLeft - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **segment** | [**SimpleSegment**](SimpleSegment.md) | | | - diff --git a/docs/EventCustomerSent.md b/docs/EventCustomerSent.md deleted file mode 100644 index 108b972b..00000000 --- a/docs/EventCustomerSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerShopifyFailed.md b/docs/EventCustomerShopifyFailed.md deleted file mode 100644 index d2b9d541..00000000 --- a/docs/EventCustomerShopifyFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerShopifyFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerShopifyRecovered.md b/docs/EventCustomerShopifyRecovered.md deleted file mode 100644 index 77da1fab..00000000 --- a/docs/EventCustomerShopifyRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerShopifyRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerShopifySent.md b/docs/EventCustomerShopifySent.md deleted file mode 100644 index 323b29bb..00000000 --- a/docs/EventCustomerShopifySent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerShopifySent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerSmsFailed.md b/docs/EventCustomerSmsFailed.md deleted file mode 100644 index 0687e81b..00000000 --- a/docs/EventCustomerSmsFailed.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerSmsFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **failed_at** | **Time** | Timestamp representing the date and time when the distribution failed in ISO 8601 format. | | - diff --git a/docs/EventCustomerSmsRecovered.md b/docs/EventCustomerSmsRecovered.md deleted file mode 100644 index 6208d484..00000000 --- a/docs/EventCustomerSmsRecovered.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerSmsRecovered - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **recovered_at** | **Time** | Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. | | - diff --git a/docs/EventCustomerSmsSent.md b/docs/EventCustomerSmsSent.md deleted file mode 100644 index 6225f469..00000000 --- a/docs/EventCustomerSmsSent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerSmsSent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **distribution** | **Object** | | [optional] | -| **sent_at** | **Time** | Timestamp representing the date and time when the distribution was sent in ISO 8601 format. | | - diff --git a/docs/EventCustomerUpdated.md b/docs/EventCustomerUpdated.md deleted file mode 100644 index 99ddec9e..00000000 --- a/docs/EventCustomerUpdated.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::EventCustomerUpdated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] | - diff --git a/docs/EventCustomerValidationFailed.md b/docs/EventCustomerValidationFailed.md deleted file mode 100644 index fb267b83..00000000 --- a/docs/EventCustomerValidationFailed.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerValidationFailed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **validation** | [**ValidationEntity**](ValidationEntity.md) | | [optional] | - diff --git a/docs/EventCustomerValidationSucceeded.md b/docs/EventCustomerValidationSucceeded.md deleted file mode 100644 index 48f3ff5e..00000000 --- a/docs/EventCustomerValidationSucceeded.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::EventCustomerValidationSucceeded - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **validation** | [**ValidationEntity**](ValidationEntity.md) | | [optional] | - diff --git a/docs/EventCustomerVoucherDeleted.md b/docs/EventCustomerVoucherDeleted.md deleted file mode 100644 index e8229dd7..00000000 --- a/docs/EventCustomerVoucherDeleted.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::EventCustomerVoucherDeleted - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | - diff --git a/docs/EventCustomerVouchersLoyaltyPointsExpired.md b/docs/EventCustomerVouchersLoyaltyPointsExpired.md deleted file mode 100644 index 95e9da71..00000000 --- a/docs/EventCustomerVouchersLoyaltyPointsExpired.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::EventCustomerVouchersLoyaltyPointsExpired - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **campaign** | [**SimpleCampaign**](SimpleCampaign.md) | | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **points** | **Integer** | | [optional] | -| **buckets** | [**Array<VoucherTransaction>**](VoucherTransaction.md) | | [optional] | -| **transaction** | [**VoucherTransaction**](VoucherTransaction.md) | | [optional] | - diff --git a/docs/EventsApi.md b/docs/EventsApi.md index eb58b79a..e0de0aa2 100644 --- a/docs/EventsApi.md +++ b/docs/EventsApi.md @@ -35,7 +35,7 @@ end api_instance = VoucherifySdk::EventsApi.new opts = { - events_create_request_body: VoucherifySdk::EventsCreateRequestBody.new({event: 'event_example', customer: VoucherifySdk::Customer.new}) # EventsCreateRequestBody | Specify the details of the custom event. + events_create_request_body: VoucherifySdk::EventsCreateRequestBody.new({customer: VoucherifySdk::Customer.new}) # EventsCreateRequestBody | Specify the details of the custom event. } begin diff --git a/docs/EventsCreateRequestBody.md b/docs/EventsCreateRequestBody.md index 47e67d07..c292b008 100644 --- a/docs/EventsCreateRequestBody.md +++ b/docs/EventsCreateRequestBody.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **event** | **String** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | | +| **event** | **String** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | [optional] | | **customer** | [**Customer**](Customer.md) | | | -| **referral** | [**ClientEventsCreateRequestBodyReferral**](ClientEventsCreateRequestBodyReferral.md) | | [optional] | -| **loyalty** | [**ClientEventsCreateRequestBodyLoyalty**](ClientEventsCreateRequestBodyLoyalty.md) | | [optional] | +| **referral** | [**EventsCreateRequestBodyReferral**](EventsCreateRequestBodyReferral.md) | | [optional] | +| **loyalty** | [**EventsCreateRequestBodyLoyalty**](EventsCreateRequestBodyLoyalty.md) | | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. | [optional] | diff --git a/docs/EventsCreateRequestBodyLoyalty.md b/docs/EventsCreateRequestBodyLoyalty.md new file mode 100644 index 00000000..1beeee13 --- /dev/null +++ b/docs/EventsCreateRequestBodyLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::EventsCreateRequestBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | [optional] | + diff --git a/docs/EventsCreateRequestBodyReferral.md b/docs/EventsCreateRequestBodyReferral.md new file mode 100644 index 00000000..ae3e7797 --- /dev/null +++ b/docs/EventsCreateRequestBodyReferral.md @@ -0,0 +1,9 @@ +# VoucherifySdk::EventsCreateRequestBodyReferral + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | A code through which a new visitor has been referred to a service. | [optional] | +| **referrer_id** | **String** | Unique ID of the referring person - it is optional and not required if the referral **code** is provided. | [optional] | + diff --git a/docs/EventsCreateResponseBody.md b/docs/EventsCreateResponseBody.md index da1b1f52..2b2b809a 100644 --- a/docs/EventsCreateResponseBody.md +++ b/docs/EventsCreateResponseBody.md @@ -4,9 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The object represented is an `event`. | [default to 'event'] | -| **type** | **String** | The event name. | | +| **object** | **String** | The object represented is an `event`. | [optional][default to 'event'] | +| **type** | **String** | The event name. | [optional] | | **customer** | [**SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | | -| **referral** | **Object** | A `null` referral object. | | -| **loyalty** | **Object** | A `null` loyalty object. | | +| **referral** | **Object** | A `null` referral object. | [optional] | +| **loyalty** | **Object** | A `null` loyalty object. | [optional] | +| **metadata** | **Object** | | [optional] | diff --git a/docs/Export.md b/docs/Export.md index a98fa7a2..717ec164 100644 --- a/docs/Export.md +++ b/docs/Export.md @@ -1,59 +1,16 @@ # VoucherifySdk::Export -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::Export.openapi_one_of -# => -# [ -# :'ExportCustomer', -# :'ExportOrder', -# :'ExportPointsExpiration', -# :'ExportPublication', -# :'ExportRedemption', -# :'ExportVoucher', -# :'ExportVoucherTransactions' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::Export.build(data) -# => # - -VoucherifySdk::Export.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ExportCustomer` -- `ExportOrder` -- `ExportPointsExpiration` -- `ExportPublication` -- `ExportRedemption` -- `ExportVoucher` -- `ExportVoucherTransactions` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the export. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] | +| **channel** | **String** | The channel through which the export was triggered. | [optional] | +| **result** | [**ExportResult**](ExportResult.md) | | [optional] | +| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] | +| **exported_object** | **String** | | [optional] | +| **parameters** | [**ExportParameters**](ExportParameters.md) | | [optional] | diff --git a/docs/ExportBase.md b/docs/ExportBase.md deleted file mode 100644 index da84789d..00000000 --- a/docs/ExportBase.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::ExportBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | - diff --git a/docs/ExportBaseResult.md b/docs/ExportBaseResult.md deleted file mode 100644 index b4f49b0b..00000000 --- a/docs/ExportBaseResult.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::ExportBaseResult - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **url** | **String** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | | - diff --git a/docs/ExportCustomer.md b/docs/ExportCustomer.md deleted file mode 100644 index 480ba408..00000000 --- a/docs/ExportCustomer.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportCustomer - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'customer'] | -| **parameters** | [**ExportCustomerBaseParameters**](ExportCustomerBaseParameters.md) | | [optional] | - diff --git a/docs/ExportCustomerBase.md b/docs/ExportCustomerBase.md deleted file mode 100644 index 97da2902..00000000 --- a/docs/ExportCustomerBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportCustomerBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'customer'] | -| **parameters** | [**ExportCustomerBaseParameters**](ExportCustomerBaseParameters.md) | | [optional] | - diff --git a/docs/ExportCustomerBaseParameters.md b/docs/ExportCustomerBaseParameters.md deleted file mode 100644 index 47600401..00000000 --- a/docs/ExportCustomerBaseParameters.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ExportCustomerBaseParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **order** | [**ExportCustomerOrder**](ExportCustomerOrder.md) | | [optional] | -| **fields** | [**Array<ExportCustomerFields>**](ExportCustomerFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | -| **filters** | **Object** | Allowed additional properties must start with \"metadata.\" or \"address.\" or \"summary.\" or \"loyalty.\" or \"loyalty_tier.\" or \"loyalty_points.\" or \"system_metadata.\" | [optional] | - diff --git a/docs/ExportCustomerFields.md b/docs/ExportCustomerFields.md deleted file mode 100644 index f8c74a89..00000000 --- a/docs/ExportCustomerFields.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportCustomerFields - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportCustomerFilters.md b/docs/ExportCustomerFilters.md deleted file mode 100644 index 34fc2f0c..00000000 --- a/docs/ExportCustomerFilters.md +++ /dev/null @@ -1,38 +0,0 @@ -# VoucherifySdk::ExportCustomerFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **name** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **description** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **email** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **address_city** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **address_state** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **address_line_1** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **address_line_2** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **address_country** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **address_postal_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemptions_total_redeemed** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemptions_total_failed** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemptions_total_succeeded** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemptions_total_rolled_back** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemptions_total_rollback_failed** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemptions_total_rollback_succeeded** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **orders_total_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **orders_total_count** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **orders_average_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **orders_last_order_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **orders_last_order_date** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **loyalty_points** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **loyalty_referred_customers** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **phone** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **birthday** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **birthdate** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ExportCustomerOrder.md b/docs/ExportCustomerOrder.md deleted file mode 100644 index 1e22342b..00000000 --- a/docs/ExportCustomerOrder.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportCustomerOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportCustomerScheduled.md b/docs/ExportCustomerScheduled.md deleted file mode 100644 index 24e42285..00000000 --- a/docs/ExportCustomerScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportCustomerScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'customer'] | -| **parameters** | [**ExportCustomerBaseParameters**](ExportCustomerBaseParameters.md) | | [optional] | - diff --git a/docs/ExportOrder.md b/docs/ExportOrder.md deleted file mode 100644 index 07669b9e..00000000 --- a/docs/ExportOrder.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'order'] | -| **parameters** | [**OrdersExportCreateRequestBodyParameters**](OrdersExportCreateRequestBodyParameters.md) | | [optional] | - diff --git a/docs/ExportOrderBase.md b/docs/ExportOrderBase.md deleted file mode 100644 index ccaa6d0f..00000000 --- a/docs/ExportOrderBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportOrderBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'order'] | -| **parameters** | [**OrdersExportCreateRequestBodyParameters**](OrdersExportCreateRequestBodyParameters.md) | | [optional] | - diff --git a/docs/ExportOrderFilters.md b/docs/ExportOrderFilters.md deleted file mode 100644 index 92802b60..00000000 --- a/docs/ExportOrderFilters.md +++ /dev/null @@ -1,21 +0,0 @@ -# VoucherifySdk::ExportOrderFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **status** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **discount_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **items_discount_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **total_discount_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **total_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **referrer_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ExportOrderScheduled.md b/docs/ExportOrderScheduled.md deleted file mode 100644 index 7a40f77c..00000000 --- a/docs/ExportOrderScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportOrderScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'order'] | -| **parameters** | [**OrdersExportCreateRequestBodyParameters**](OrdersExportCreateRequestBodyParameters.md) | | [optional] | - diff --git a/docs/ExportParameters.md b/docs/ExportParameters.md new file mode 100644 index 00000000..fd49a444 --- /dev/null +++ b/docs/ExportParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ExportParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | **String** | | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | +| **filters** | [**ExportParametersFilters**](ExportParametersFilters.md) | | [optional] | + diff --git a/docs/ExportParametersFilters.md b/docs/ExportParametersFilters.md new file mode 100644 index 00000000..66575ee3 --- /dev/null +++ b/docs/ExportParametersFilters.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ExportParametersFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | [optional] | +| **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ExportPointsExpiration.md b/docs/ExportPointsExpiration.md deleted file mode 100644 index f17e7a5b..00000000 --- a/docs/ExportPointsExpiration.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportPointsExpiration - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'points_expiration'] | -| **parameters** | [**ExportPointsExpirationBaseParameters**](ExportPointsExpirationBaseParameters.md) | | [optional] | - diff --git a/docs/ExportPointsExpirationBase.md b/docs/ExportPointsExpirationBase.md deleted file mode 100644 index 922e36d1..00000000 --- a/docs/ExportPointsExpirationBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportPointsExpirationBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'points_expiration'] | -| **parameters** | [**ExportPointsExpirationBaseParameters**](ExportPointsExpirationBaseParameters.md) | | [optional] | - diff --git a/docs/ExportPointsExpirationBaseParameters.md b/docs/ExportPointsExpirationBaseParameters.md deleted file mode 100644 index f2ab84da..00000000 --- a/docs/ExportPointsExpirationBaseParameters.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ExportPointsExpirationBaseParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **order** | [**ExportPointsExpirationOrder**](ExportPointsExpirationOrder.md) | | [optional] | -| **fields** | [**Array<ExportPointsExpirationFields>**](ExportPointsExpirationFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | -| **filters** | [**ExportPointsExpirationFilters**](ExportPointsExpirationFilters.md) | | [optional] | - diff --git a/docs/ExportPointsExpirationFields.md b/docs/ExportPointsExpirationFields.md deleted file mode 100644 index 57a6223b..00000000 --- a/docs/ExportPointsExpirationFields.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportPointsExpirationFields - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportPointsExpirationFilters.md b/docs/ExportPointsExpirationFilters.md deleted file mode 100644 index afd53926..00000000 --- a/docs/ExportPointsExpirationFilters.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ExportPointsExpirationFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ExportPointsExpirationOrder.md b/docs/ExportPointsExpirationOrder.md deleted file mode 100644 index ae57565a..00000000 --- a/docs/ExportPointsExpirationOrder.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportPointsExpirationOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportPointsExpirationScheduled.md b/docs/ExportPointsExpirationScheduled.md deleted file mode 100644 index ac1b8049..00000000 --- a/docs/ExportPointsExpirationScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportPointsExpirationScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'points_expiration'] | -| **parameters** | [**ExportPointsExpirationBaseParameters**](ExportPointsExpirationBaseParameters.md) | | [optional] | - diff --git a/docs/ExportPublication.md b/docs/ExportPublication.md deleted file mode 100644 index 509eb98d..00000000 --- a/docs/ExportPublication.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportPublication - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'publication'] | -| **parameters** | [**ExportPublicationBaseParameters**](ExportPublicationBaseParameters.md) | | [optional] | - diff --git a/docs/ExportPublicationBase.md b/docs/ExportPublicationBase.md deleted file mode 100644 index 8182e2d2..00000000 --- a/docs/ExportPublicationBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportPublicationBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'publication'] | -| **parameters** | [**ExportPublicationBaseParameters**](ExportPublicationBaseParameters.md) | | [optional] | - diff --git a/docs/ExportPublicationBaseParameters.md b/docs/ExportPublicationBaseParameters.md deleted file mode 100644 index d65bb4a9..00000000 --- a/docs/ExportPublicationBaseParameters.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ExportPublicationBaseParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **order** | [**ExportPublicationOrder**](ExportPublicationOrder.md) | | [optional] | -| **fields** | [**Array<ExportPublicationFields>**](ExportPublicationFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | -| **filters** | **Object** | Allowed additional properties must start with \"metadata.\" | [optional] | - diff --git a/docs/ExportPublicationFields.md b/docs/ExportPublicationFields.md deleted file mode 100644 index e61ecfb6..00000000 --- a/docs/ExportPublicationFields.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportPublicationFields - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportPublicationFilters.md b/docs/ExportPublicationFilters.md deleted file mode 100644 index e56c5756..00000000 --- a/docs/ExportPublicationFilters.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportPublicationFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **voucher_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **date** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **channel** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **campaign** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **is_winner** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ExportPublicationOrder.md b/docs/ExportPublicationOrder.md deleted file mode 100644 index c81444a6..00000000 --- a/docs/ExportPublicationOrder.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportPublicationOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportPublicationScheduled.md b/docs/ExportPublicationScheduled.md deleted file mode 100644 index 5bdd8866..00000000 --- a/docs/ExportPublicationScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportPublicationScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'publication'] | -| **parameters** | [**ExportPublicationBaseParameters**](ExportPublicationBaseParameters.md) | | [optional] | - diff --git a/docs/ExportRedemption.md b/docs/ExportRedemption.md deleted file mode 100644 index 43835076..00000000 --- a/docs/ExportRedemption.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportRedemption - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'redemption'] | -| **parameters** | [**ExportRedemptionBaseParameters**](ExportRedemptionBaseParameters.md) | | [optional] | - diff --git a/docs/ExportRedemptionBase.md b/docs/ExportRedemptionBase.md deleted file mode 100644 index f0b4d3a6..00000000 --- a/docs/ExportRedemptionBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportRedemptionBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'redemption'] | -| **parameters** | [**ExportRedemptionBaseParameters**](ExportRedemptionBaseParameters.md) | | [optional] | - diff --git a/docs/ExportRedemptionBaseParameters.md b/docs/ExportRedemptionBaseParameters.md deleted file mode 100644 index 98d13108..00000000 --- a/docs/ExportRedemptionBaseParameters.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ExportRedemptionBaseParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **order** | [**ExportRedemptionOrder**](ExportRedemptionOrder.md) | | [optional] | -| **fields** | [**Array<ExportRedemptionFields>**](ExportRedemptionFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | -| **filters** | **Object** | Allowed additional properties must start with \"metadata.\" | [optional] | - diff --git a/docs/ExportRedemptionFields.md b/docs/ExportRedemptionFields.md deleted file mode 100644 index 7f4812ba..00000000 --- a/docs/ExportRedemptionFields.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportRedemptionFields - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportRedemptionFilters.md b/docs/ExportRedemptionFilters.md deleted file mode 100644 index b3b72bb1..00000000 --- a/docs/ExportRedemptionFilters.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::ExportRedemptionFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **object** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **date** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **voucher_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **campaign** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **promotion_tier_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_name** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **tracking_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **order_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **gift_amount** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **loyalty_points** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **result** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **failure_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **failure_message** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ExportRedemptionOrder.md b/docs/ExportRedemptionOrder.md deleted file mode 100644 index d96b826b..00000000 --- a/docs/ExportRedemptionOrder.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportRedemptionOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportRedemptionScheduled.md b/docs/ExportRedemptionScheduled.md deleted file mode 100644 index df47dbd8..00000000 --- a/docs/ExportRedemptionScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportRedemptionScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'redemption'] | -| **parameters** | [**ExportRedemptionBaseParameters**](ExportRedemptionBaseParameters.md) | | [optional] | - diff --git a/docs/ExportResult.md b/docs/ExportResult.md new file mode 100644 index 00000000..7b9238ff --- /dev/null +++ b/docs/ExportResult.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ExportResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | [optional] | + diff --git a/docs/ExportScheduledBase.md b/docs/ExportScheduledBase.md deleted file mode 100644 index 164458b8..00000000 --- a/docs/ExportScheduledBase.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::ExportScheduledBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | - diff --git a/docs/ExportVoucher.md b/docs/ExportVoucher.md deleted file mode 100644 index da9dc705..00000000 --- a/docs/ExportVoucher.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher'] | -| **parameters** | [**ExportVoucherBaseParameters**](ExportVoucherBaseParameters.md) | | [optional] | - diff --git a/docs/ExportVoucherBase.md b/docs/ExportVoucherBase.md deleted file mode 100644 index c86a5f2f..00000000 --- a/docs/ExportVoucherBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportVoucherBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher'] | -| **parameters** | [**ExportVoucherBaseParameters**](ExportVoucherBaseParameters.md) | | [optional] | - diff --git a/docs/ExportVoucherBaseParameters.md b/docs/ExportVoucherBaseParameters.md deleted file mode 100644 index d38fd813..00000000 --- a/docs/ExportVoucherBaseParameters.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ExportVoucherBaseParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **order** | [**ExportVoucherOrder**](ExportVoucherOrder.md) | | [optional] | -| **fields** | [**Array<ExportVoucherFields>**](ExportVoucherFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | -| **filters** | **Object** | Allowed additional properties must start with \"metadata.\" or \"redemption.\" | [optional] | - diff --git a/docs/ExportVoucherFields.md b/docs/ExportVoucherFields.md deleted file mode 100644 index 871ac22c..00000000 --- a/docs/ExportVoucherFields.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportVoucherFields - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportVoucherFilters.md b/docs/ExportVoucherFilters.md deleted file mode 100644 index 72040827..00000000 --- a/docs/ExportVoucherFilters.md +++ /dev/null @@ -1,38 +0,0 @@ -# VoucherifySdk::ExportVoucherFilters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | [optional] | -| **code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **voucher_type** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **value** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **discount_type** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **campaign** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **category** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **start_date** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **expiration_date** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **gift_balance** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **loyalty_balance** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemption_quantity** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **redemption_count** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **active** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **qr_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **bar_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **is_referral_code** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **validity_timeframe_interval** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **validity_timeframe_duration** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **validity_day_of_week** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **discount_amount_limit** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **additional_info** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **discount_unit_type** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **discount_unit_effect** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **customer_source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ExportVoucherOrder.md b/docs/ExportVoucherOrder.md deleted file mode 100644 index e7c8305d..00000000 --- a/docs/ExportVoucherOrder.md +++ /dev/null @@ -1,7 +0,0 @@ -# VoucherifySdk::ExportVoucherOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - diff --git a/docs/ExportVoucherScheduled.md b/docs/ExportVoucherScheduled.md deleted file mode 100644 index f6794723..00000000 --- a/docs/ExportVoucherScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportVoucherScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher'] | -| **parameters** | [**ExportVoucherBaseParameters**](ExportVoucherBaseParameters.md) | | [optional] | - diff --git a/docs/ExportVoucherTransactions.md b/docs/ExportVoucherTransactions.md deleted file mode 100644 index b868f47f..00000000 --- a/docs/ExportVoucherTransactions.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportVoucherTransactions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher_transactions'] | -| **parameters** | [**LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) | | [optional] | - diff --git a/docs/ExportVoucherTransactionsBase.md b/docs/ExportVoucherTransactionsBase.md deleted file mode 100644 index f0d0f4d1..00000000 --- a/docs/ExportVoucherTransactionsBase.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::ExportVoucherTransactionsBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher_transactions'] | -| **parameters** | [**LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) | | [optional] | - diff --git a/docs/ExportVoucherTransactionsScheduled.md b/docs/ExportVoucherTransactionsScheduled.md deleted file mode 100644 index 3abd779d..00000000 --- a/docs/ExportVoucherTransactionsScheduled.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ExportVoucherTransactionsScheduled - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher_transactions'] | -| **parameters** | [**LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) | | [optional] | - diff --git a/docs/ExportsApi.md b/docs/ExportsApi.md index 4a34df59..020c21a6 100644 --- a/docs/ExportsApi.md +++ b/docs/ExportsApi.md @@ -17,7 +17,7 @@ All URIs are relative to *https://api.voucherify.io* Create Export -Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions +Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions ### Examples @@ -39,7 +39,7 @@ end api_instance = VoucherifySdk::ExportsApi.new opts = { - exports_create_request_body: VoucherifySdk::ExportCustomerBase.new({exported_object: 'customer'}) # ExportsCreateRequestBody | Specify the details of the export that you would like to create. + exports_create_request_body: VoucherifySdk::ExportsCreateRequestBody.new # ExportsCreateRequestBody | Specify the details of the export that you would like to create. } begin @@ -264,8 +264,8 @@ end api_instance = VoucherifySdk::ExportsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrderListExports::CREATED_AT # ParameterOrderListExports | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. } @@ -282,8 +282,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrderListExports**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type diff --git a/docs/ExportsCreateRequestBody.md b/docs/ExportsCreateRequestBody.md index 732c1d76..c5716ae0 100644 --- a/docs/ExportsCreateRequestBody.md +++ b/docs/ExportsCreateRequestBody.md @@ -1,59 +1,9 @@ # VoucherifySdk::ExportsCreateRequestBody -## Class instance methods +## Properties -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ExportsCreateRequestBody.openapi_one_of -# => -# [ -# :'ExportCustomerBase', -# :'ExportOrderBase', -# :'ExportPointsExpirationBase', -# :'ExportPublicationBase', -# :'ExportRedemptionBase', -# :'ExportVoucherBase', -# :'ExportVoucherTransactionsBase' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ExportsCreateRequestBody.build(data) -# => # - -VoucherifySdk::ExportsCreateRequestBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ExportCustomerBase` -- `ExportOrderBase` -- `ExportPointsExpirationBase` -- `ExportPublicationBase` -- `ExportRedemptionBase` -- `ExportVoucherBase` -- `ExportVoucherTransactionsBase` -- `nil` (if no type matches) +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **exported_object** | **String** | | [optional] | +| **parameters** | [**ExportsCreateRequestBodyParameters**](ExportsCreateRequestBodyParameters.md) | | [optional] | diff --git a/docs/ExportsCreateRequestBodyParameters.md b/docs/ExportsCreateRequestBodyParameters.md new file mode 100644 index 00000000..658cf29b --- /dev/null +++ b/docs/ExportsCreateRequestBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ExportsCreateRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | **String** | | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | +| **filters** | [**ExportsCreateRequestBodyParametersFilters**](ExportsCreateRequestBodyParametersFilters.md) | | [optional] | + diff --git a/docs/ExportsCreateRequestBodyParametersFilters.md b/docs/ExportsCreateRequestBodyParametersFilters.md new file mode 100644 index 00000000..3667cdf3 --- /dev/null +++ b/docs/ExportsCreateRequestBodyParametersFilters.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ExportsCreateRequestBodyParametersFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | [optional] | +| **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ExportsCreateResponseBody.md b/docs/ExportsCreateResponseBody.md index 7392df22..921c8259 100644 --- a/docs/ExportsCreateResponseBody.md +++ b/docs/ExportsCreateResponseBody.md @@ -1,59 +1,16 @@ # VoucherifySdk::ExportsCreateResponseBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ExportsCreateResponseBody.openapi_one_of -# => -# [ -# :'ExportCustomerScheduled', -# :'ExportOrderScheduled', -# :'ExportPointsExpirationScheduled', -# :'ExportPublicationScheduled', -# :'ExportRedemptionScheduled', -# :'ExportVoucherScheduled', -# :'ExportVoucherTransactionsScheduled' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ExportsCreateResponseBody.build(data) -# => # - -VoucherifySdk::ExportsCreateResponseBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ExportCustomerScheduled` -- `ExportOrderScheduled` -- `ExportPointsExpirationScheduled` -- `ExportPublicationScheduled` -- `ExportRedemptionScheduled` -- `ExportVoucherScheduled` -- `ExportVoucherTransactionsScheduled` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the export. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional][default to 'SCHEDULED'] | +| **channel** | **String** | The channel through which the export was triggered. | [optional] | +| **result** | **Object** | Contains the URL of the CSV file. | [optional] | +| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] | +| **exported_object** | **String** | | [optional] | +| **parameters** | [**ExportsCreateResponseBodyParameters**](ExportsCreateResponseBodyParameters.md) | | [optional] | diff --git a/docs/ExportsCreateResponseBodyParameters.md b/docs/ExportsCreateResponseBodyParameters.md new file mode 100644 index 00000000..bb86e280 --- /dev/null +++ b/docs/ExportsCreateResponseBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ExportsCreateResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | **String** | | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | +| **filters** | [**ExportsCreateResponseBodyParametersFilters**](ExportsCreateResponseBodyParametersFilters.md) | | [optional] | + diff --git a/docs/ExportsCreateResponseBodyParametersFilters.md b/docs/ExportsCreateResponseBodyParametersFilters.md new file mode 100644 index 00000000..e647aacb --- /dev/null +++ b/docs/ExportsCreateResponseBodyParametersFilters.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ExportsCreateResponseBodyParametersFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | [optional] | +| **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ExportsGetResponseBody.md b/docs/ExportsGetResponseBody.md index 99f2fc70..7f752026 100644 --- a/docs/ExportsGetResponseBody.md +++ b/docs/ExportsGetResponseBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the export. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] | | **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | [**ExportBaseResult**](ExportBaseResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher_transactions'] | -| **parameters** | [**LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) | | [optional] | +| **result** | [**ExportsGetResponseBodyResult**](ExportsGetResponseBodyResult.md) | | [optional] | +| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] | +| **exported_object** | **String** | | [optional] | +| **parameters** | [**ExportsGetResponseBodyParameters**](ExportsGetResponseBodyParameters.md) | | [optional] | diff --git a/docs/ExportsGetResponseBodyParameters.md b/docs/ExportsGetResponseBodyParameters.md new file mode 100644 index 00000000..1b1e7aa6 --- /dev/null +++ b/docs/ExportsGetResponseBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ExportsGetResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | **String** | | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | +| **filters** | [**ExportsGetResponseBodyParametersFilters**](ExportsGetResponseBodyParametersFilters.md) | | [optional] | + diff --git a/docs/ExportsGetResponseBodyParametersFilters.md b/docs/ExportsGetResponseBodyParametersFilters.md new file mode 100644 index 00000000..19b59729 --- /dev/null +++ b/docs/ExportsGetResponseBodyParametersFilters.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ExportsGetResponseBodyParametersFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | [optional] | +| **campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ExportsGetResponseBodyResult.md b/docs/ExportsGetResponseBodyResult.md new file mode 100644 index 00000000..9804d6fc --- /dev/null +++ b/docs/ExportsGetResponseBodyResult.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ExportsGetResponseBodyResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | [optional] | + diff --git a/docs/ExportsListResponseBody.md b/docs/ExportsListResponseBody.md index fdd9830b..76c02b83 100644 --- a/docs/ExportsListResponseBody.md +++ b/docs/ExportsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about exports. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of exports. | [default to 'exports'] | -| **exports** | [**Array<Export>**](Export.md) | An array of export objects. | | -| **total** | **Integer** | Total number of exports. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about exports. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of exports. | [optional][default to 'exports'] | +| **exports** | [**Array<Export>**](Export.md) | An array of export objects. | [optional] | +| **total** | **Integer** | Total number of exports. | [optional] | diff --git a/docs/FilterConditionsString.md b/docs/FilterConditionsString.md index f3a303e1..b234dccc 100644 --- a/docs/FilterConditionsString.md +++ b/docs/FilterConditionsString.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **_in** | **Array<String>** | Array of resource values that should be included in the results. (multiple values) | [optional] | -| **not_in** | **Array<String>** | Array of resource values that should be included in the results. (multiple values) | [optional] | -| **is** | **String** | Value is exactly this value. (single value) | [optional] | -| **is_not** | **String** | Results omit this value. (single value) | [optional] | +| **_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **not_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **is** | **String** | Value is exactly this value (single value). | [optional] | +| **is_not** | **String** | Results omit this value (single value). | [optional] | | **has_value** | **String** | Value is NOT null. The value for this parameter is an empty string. | [optional] | | **is_unknown** | **String** | Value is null. The value for this parameter is an empty string. | [optional] | | **starts_with** | **String** | Value starts with the specified string. | [optional] | diff --git a/docs/FiltersCondition.md b/docs/FiltersCondition.md index 3f13f85a..d3d1d5fb 100644 --- a/docs/FiltersCondition.md +++ b/docs/FiltersCondition.md @@ -4,29 +4,29 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **_in** | [**Any**](Any.md) | | [optional] | -| **not_in** | [**Any**](Any.md) | | [optional] | -| **is** | [**Any**](Any.md) | | [optional] | -| **is_days_ago** | [**Any**](Any.md) | | [optional] | -| **is_days_in_future** | [**Any**](Any.md) | | [optional] | -| **is_not** | [**Any**](Any.md) | | [optional] | -| **has_value** | [**Any**](Any.md) | | [optional] | -| **is_unknown** | [**Any**](Any.md) | | [optional] | -| **contains** | [**Any**](Any.md) | | [optional] | -| **not_contain** | [**Any**](Any.md) | | [optional] | -| **starts_with** | [**Any**](Any.md) | | [optional] | -| **ends_with** | [**Any**](Any.md) | | [optional] | -| **more_than** | [**Any**](Any.md) | | [optional] | -| **less_than** | [**Any**](Any.md) | | [optional] | -| **more_than_ago** | [**Any**](Any.md) | | [optional] | -| **less_than_ago** | [**Any**](Any.md) | | [optional] | -| **more_than_future** | [**Any**](Any.md) | | [optional] | -| **less_than_future** | [**Any**](Any.md) | | [optional] | -| **more_than_equal** | [**Any**](Any.md) | | [optional] | -| **less_than_equal** | [**Any**](Any.md) | | [optional] | -| **after** | [**Any**](Any.md) | | [optional] | -| **before** | [**Any**](Any.md) | | [optional] | -| **count** | [**Any**](Any.md) | | [optional] | -| **count_less** | [**Any**](Any.md) | | [optional] | -| **count_more** | [**Any**](Any.md) | | [optional] | +| **_in** | **Object** | | [optional] | +| **not_in** | **Object** | | [optional] | +| **is** | **Object** | | [optional] | +| **is_days_ago** | **Object** | | [optional] | +| **is_days_in_future** | **Object** | | [optional] | +| **is_not** | **Object** | | [optional] | +| **has_value** | **Object** | | [optional] | +| **is_unknown** | **Object** | | [optional] | +| **contains** | **Object** | | [optional] | +| **not_contain** | **Object** | | [optional] | +| **starts_with** | **Object** | | [optional] | +| **ends_with** | **Object** | | [optional] | +| **more_than** | **Object** | | [optional] | +| **less_than** | **Object** | | [optional] | +| **more_than_ago** | **Object** | | [optional] | +| **less_than_ago** | **Object** | | [optional] | +| **more_than_future** | **Object** | | [optional] | +| **less_than_future** | **Object** | | [optional] | +| **more_than_equal** | **Object** | | [optional] | +| **less_than_equal** | **Object** | | [optional] | +| **after** | **Object** | | [optional] | +| **before** | **Object** | | [optional] | +| **count** | **Object** | | [optional] | +| **count_less** | **Object** | | [optional] | +| **count_more** | **Object** | | [optional] | diff --git a/docs/Gift.md b/docs/Gift.md index b89a44d3..3649a4a8 100644 --- a/docs/Gift.md +++ b/docs/Gift.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **amount** | **Float** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | | -| **balance** | **Float** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | | +| **amount** | **Float** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Float** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | | **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | diff --git a/docs/GiftCampaignVoucher.md b/docs/GiftCampaignVoucher.md deleted file mode 100644 index 16580c50..00000000 --- a/docs/GiftCampaignVoucher.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::GiftCampaignVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of voucher. | [default to 'GIFT_VOUCHER'] | -| **gift** | [**Gift**](Gift.md) | | | -| **redemption** | [**CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] | -| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | - diff --git a/docs/GiveawayCampaignVoucher.md b/docs/GiveawayCampaignVoucher.md deleted file mode 100644 index c1e92826..00000000 --- a/docs/GiveawayCampaignVoucher.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::GiveawayCampaignVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of voucher. | [default to 'DISCOUNT_VOUCHER'] | -| **discount** | [**Discount**](Discount.md) | | | -| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | -| **redemption** | [**CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] | -| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | - diff --git a/docs/InapplicableTo.md b/docs/InapplicableTo.md index 78548a4d..1635afff 100644 --- a/docs/InapplicableTo.md +++ b/docs/InapplicableTo.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | This object stores information about the product collection. | | -| **id** | **String** | Unique product collection ID assigned by Voucherify. | | +| **object** | **String** | This object stores information about the product collection. | [optional] | +| **id** | **String** | Unique product collection ID assigned by Voucherify. | [optional] | | **source_id** | **String** | The source ID from your inventory system. | [optional] | | **product_id** | **String** | Parent product's unique ID assigned by Voucherify. | [optional] | | **product_source_id** | **String** | Parent product's source ID from your inventory system. | [optional] | -| **strict** | **Boolean** | | | +| **strict** | **Boolean** | | [optional] | | **price** | **Float** | New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. | [optional] | | **price_formula** | **Float** | Formula used to calculate the discounted price of an item. | [optional] | | **effect** | [**ApplicableToEffect**](ApplicableToEffect.md) | | | @@ -18,4 +18,7 @@ | **amount_limit** | **Integer** | Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] | | **aggregated_amount_limit** | **Integer** | 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) | [optional] | | **order_item_indices** | **Array<Integer>** | | [optional] | +| **repeat** | **Integer** | | [optional] | +| **skip_initially** | **Integer** | | [optional] | +| **target** | **String** | | [optional] | diff --git a/docs/InapplicableToResultList.md b/docs/InapplicableToResultList.md index 96c69254..5695082e 100644 --- a/docs/InapplicableToResultList.md +++ b/docs/InapplicableToResultList.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **data** | [**Array<InapplicableTo>**](InapplicableTo.md) | Contains array of items to which the discount cannot apply. | | -| **total** | **Integer** | Total number of objects defining included products, SKUs, or product collections. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'list'] | -| **data_ref** | **String** | The type of object represented by JSON. | [default to 'data'] | +| **data** | [**Array<InapplicableTo>**](InapplicableTo.md) | Contains array of items to which the discount cannot apply. | [optional] | +| **total** | **Integer** | Total number of objects defining included products, SKUs, or product collections. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | The type of the object represented by JSON. | [optional][default to 'data'] | diff --git a/docs/ListPublicationsItemBase.md b/docs/ListPublicationsItemBase.md deleted file mode 100644 index 6f00b716..00000000 --- a/docs/ListPublicationsItemBase.md +++ /dev/null @@ -1,17 +0,0 @@ -# VoucherifySdk::ListPublicationsItemBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | - diff --git a/docs/ListPublicationsItemInvalid.md b/docs/ListPublicationsItemInvalid.md deleted file mode 100644 index 9b17fd25..00000000 --- a/docs/ListPublicationsItemInvalid.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::ListPublicationsItemInvalid - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | -| **result** | **String** | Status of the publication attempt. | [default to 'FAILURE'] | -| **failure_code** | **String** | Generic reason as to why the create publication operation failed. | [optional] | -| **failure_message** | **String** | This parameter will provide more expanded reason as to why the create publication operation failed. | [optional] | - diff --git a/docs/ListPublicationsItemValidMultipleVouchers.md b/docs/ListPublicationsItemValidMultipleVouchers.md deleted file mode 100644 index 7582ecc2..00000000 --- a/docs/ListPublicationsItemValidMultipleVouchers.md +++ /dev/null @@ -1,19 +0,0 @@ -# VoucherifySdk::ListPublicationsItemValidMultipleVouchers - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | -| **result** | **String** | Status of the publication attempt. | [default to 'SUCCESS'] | -| **vouchers** | **Array<String>** | Contains the unique voucher codes that was assigned by Voucherify. | | - diff --git a/docs/ListPublicationsItemValidSingleVoucher.md b/docs/ListPublicationsItemValidSingleVoucher.md deleted file mode 100644 index 2293f3ae..00000000 --- a/docs/ListPublicationsItemValidSingleVoucher.md +++ /dev/null @@ -1,19 +0,0 @@ -# VoucherifySdk::ListPublicationsItemValidSingleVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | -| **result** | **String** | Status of the publication attempt. | [default to 'SUCCESS'] | -| **voucher** | [**ListPublicationsItemVoucher**](ListPublicationsItemVoucher.md) | | | - diff --git a/docs/ListPublicationsItemVoucher.md b/docs/ListPublicationsItemVoucher.md index 6654a06c..9b897211 100644 --- a/docs/ListPublicationsItemVoucher.md +++ b/docs/ListPublicationsItemVoucher.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **String** | Voucher code. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'voucher'] | -| **campaign** | **String** | Campaign name | | +| **code** | **String** | Voucher code. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'voucher'] | +| **campaign** | **String** | Campaign name | [optional] | | **gift** | [**Gift**](Gift.md) | | [optional] | | **loyalty_card** | **Object** | Defines the loyalty card details. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | diff --git a/docs/LoyaltiesApi.md b/docs/LoyaltiesApi.md index a09a0d81..951706cc 100644 --- a/docs/LoyaltiesApi.md +++ b/docs/LoyaltiesApi.md @@ -4,7 +4,12 @@ All URIs are relative to *https://api.voucherify.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**add_member**](LoyaltiesApi.md#add_member) | **POST** /v1/loyalties/{campaignId}/members | Add Member | +| [**create_earning_rule**](LoyaltiesApi.md#create_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules | Create Earning Rule | | [**create_in_bulk_loyalty_tiers**](LoyaltiesApi.md#create_in_bulk_loyalty_tiers) | **POST** /v1/loyalties/{campaignId}/tiers | Create loyalty tiers | +| [**create_loyalty_program**](LoyaltiesApi.md#create_loyalty_program) | **POST** /v1/loyalties | Create Loyalty Campaign | +| [**create_points_expiration_export**](LoyaltiesApi.md#create_points_expiration_export) | **POST** /v1/loyalties/{campaignId}/points-expiration/export | Create Points Expiration Export | +| [**create_reward_assignment1**](LoyaltiesApi.md#create_reward_assignment1) | **POST** /v1/loyalties/{campaignId}/rewards | Create Reward Assignment | | [**delete_earning_rule**](LoyaltiesApi.md#delete_earning_rule) | **DELETE** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Delete Earning Rule | | [**delete_loyalty_program**](LoyaltiesApi.md#delete_loyalty_program) | **DELETE** /v1/loyalties/{campaignId} | Delete Loyalty Campaign | | [**delete_reward_assignment1**](LoyaltiesApi.md#delete_reward_assignment1) | **DELETE** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Delete Reward Assignment | @@ -13,23 +18,160 @@ All URIs are relative to *https://api.voucherify.io* | [**export_loyalty_card_transactions**](LoyaltiesApi.md#export_loyalty_card_transactions) | **POST** /v1/loyalties/members/{memberId}/transactions/export | Export Loyalty Card Transactions | | [**export_loyalty_card_transactions1**](LoyaltiesApi.md#export_loyalty_card_transactions1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | Export Loyalty Card Transactions | | [**get_earning_rule**](LoyaltiesApi.md#get_earning_rule) | **GET** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Get Earning Rule | +| [**get_loyalty_program**](LoyaltiesApi.md#get_loyalty_program) | **GET** /v1/loyalties/{campaignId} | Get Loyalty Campaign | | [**get_loyalty_tier**](LoyaltiesApi.md#get_loyalty_tier) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | Get Loyalty Tier | +| [**get_member**](LoyaltiesApi.md#get_member) | **GET** /v1/loyalties/members/{memberId} | Get Member | +| [**get_member1**](LoyaltiesApi.md#get_member1) | **GET** /v1/loyalties/{campaignId}/members/{memberId} | Get Member | | [**get_reward_assignment1**](LoyaltiesApi.md#get_reward_assignment1) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | Get Reward Assignment | | [**get_reward_assignment2**](LoyaltiesApi.md#get_reward_assignment2) | **GET** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Get Reward Assignment | | [**get_reward_details**](LoyaltiesApi.md#get_reward_details) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | Get Reward Details | +| [**list_earning_rules**](LoyaltiesApi.md#list_earning_rules) | **GET** /v1/loyalties/{campaignId}/earning-rules | List Earning Rules | | [**list_loyalty_card_transactions**](LoyaltiesApi.md#list_loyalty_card_transactions) | **GET** /v1/loyalties/members/{memberId}/transactions | List Loyalty Card Transactions | | [**list_loyalty_card_transactions1**](LoyaltiesApi.md#list_loyalty_card_transactions1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/transactions | List Loyalty Card Transactions | +| [**list_loyalty_programs**](LoyaltiesApi.md#list_loyalty_programs) | **GET** /v1/loyalties | List Loyalty Campaigns | | [**list_loyalty_tier_earning_rules**](LoyaltiesApi.md#list_loyalty_tier_earning_rules) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | List Loyalty Tier Earning Rules | | [**list_loyalty_tier_rewards**](LoyaltiesApi.md#list_loyalty_tier_rewards) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | List Loyalty Tier Rewards | | [**list_loyalty_tiers**](LoyaltiesApi.md#list_loyalty_tiers) | **GET** /v1/loyalties/{campaignId}/tiers | List Loyalty Tiers | +| [**list_member_activity**](LoyaltiesApi.md#list_member_activity) | **GET** /v1/loyalties/members/{memberId}/activity | List Member Activity | +| [**list_member_activity1**](LoyaltiesApi.md#list_member_activity1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/activity | List Member Activity | | [**list_member_loyalty_tier**](LoyaltiesApi.md#list_member_loyalty_tier) | **GET** /v1/loyalties/members/{memberId}/tiers | List Member's Loyalty Tiers | | [**list_member_rewards**](LoyaltiesApi.md#list_member_rewards) | **GET** /v1/loyalties/members/{memberId}/rewards | List Member Rewards | +| [**list_members**](LoyaltiesApi.md#list_members) | **GET** /v1/loyalties/{campaignId}/members | List Members | | [**list_points_expiration**](LoyaltiesApi.md#list_points_expiration) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | Get Points Expiration | +| [**list_reward_assignments1**](LoyaltiesApi.md#list_reward_assignments1) | **GET** /v1/loyalties/{campaignId}/reward-assignments | List Reward Assignments | +| [**list_reward_assignments2**](LoyaltiesApi.md#list_reward_assignments2) | **GET** /v1/loyalties/{campaignId}/rewards | List Reward Assignments | | [**redeem_reward**](LoyaltiesApi.md#redeem_reward) | **POST** /v1/loyalties/members/{memberId}/redemption | Redeem Reward | | [**redeem_reward1**](LoyaltiesApi.md#redeem_reward1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/redemption | Redeem Reward | | [**transfer_points**](LoyaltiesApi.md#transfer_points) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transfers | Transfer Loyalty Points | +| [**update_earning_rule**](LoyaltiesApi.md#update_earning_rule) | **PUT** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Update Earning Rule | | [**update_loyalty_card_balance**](LoyaltiesApi.md#update_loyalty_card_balance) | **POST** /v1/loyalties/members/{memberId}/balance | Add or Remove Loyalty Card Balance | | [**update_loyalty_card_balance1**](LoyaltiesApi.md#update_loyalty_card_balance1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/balance | Add or Remove Loyalty Card Balance | +| [**update_loyalty_program**](LoyaltiesApi.md#update_loyalty_program) | **PUT** /v1/loyalties/{campaignId} | Update Loyalty Campaign | +| [**update_reward_assignment1**](LoyaltiesApi.md#update_reward_assignment1) | **PUT** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Update Reward Assignment | + + +## add_member + +> add_member(campaign_id, opts) + +Add Member + +This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. 📘 Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID of the loyalty program. +opts = { + loyalties_members_create_request_body: VoucherifySdk::LoyaltiesMembersCreateRequestBody.new # LoyaltiesMembersCreateRequestBody | Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. +} + +begin + # Add Member + result = api_instance.add_member(campaign_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->add_member: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID of the loyalty program. | | +| **loyalties_members_create_request_body** | [**LoyaltiesMembersCreateRequestBody**](LoyaltiesMembersCreateRequestBody.md) | Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. | [optional] | + +### Return type + +[**LoyaltiesMembersCreateResponseBody**](LoyaltiesMembersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_earning_rule + +> > create_earning_rule(campaign_id, opts) + +Create Earning Rule + +Create earning rules for a loyalty campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +opts = { + loyalties_earning_rules_create_request_body_item: [VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItem.new] # Array | Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object +} + +begin + # Create Earning Rule + result = api_instance.create_earning_rule(campaign_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->create_earning_rule: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **loyalties_earning_rules_create_request_body_item** | [**Array<LoyaltiesEarningRulesCreateRequestBodyItem>**](LoyaltiesEarningRulesCreateRequestBodyItem.md) | Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object | [optional] | + +### Return type + +[**Array<LoyaltiesEarningRulesCreateResponseBody>**](LoyaltiesEarningRulesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json ## create_in_bulk_loyalty_tiers @@ -61,7 +203,7 @@ end api_instance = VoucherifySdk::LoyaltiesApi.new campaign_id = 'campaign_id_example' # String | Unique loyalty campaign ID or name. opts = { - loyalties_tiers_create_in_bulk_request_body_item: [VoucherifySdk::LoyaltiesTiersCreateInBulkRequestBodyItem.new({name: 'name_example', points: VoucherifySdk::LoyaltyTierBasePoints.new})] # Array | Provide tier definitions you want to add to existing loyalty campaign. + loyalties_tiers_create_in_bulk_request_body_item: [VoucherifySdk::LoyaltiesTiersCreateInBulkRequestBodyItem.new] # Array | Provide tier definitions you want to add to existing loyalty campaign. } begin @@ -82,7 +224,973 @@ end ### Return type -[**Array<LoyaltyTier>**](LoyaltyTier.md) +[**Array<LoyaltyTier>**](LoyaltyTier.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_loyalty_program + +> create_loyalty_program(opts) + +Create Loyalty Campaign + +Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. 📘 Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. 🚧 Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +opts = { + loyalties_create_campaign_request_body: VoucherifySdk::LoyaltiesCreateCampaignRequestBody.new # LoyaltiesCreateCampaignRequestBody | Specify the loyalty campaign details. +} + +begin + # Create Loyalty Campaign + result = api_instance.create_loyalty_program(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->create_loyalty_program: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalties_create_campaign_request_body** | [**LoyaltiesCreateCampaignRequestBody**](LoyaltiesCreateCampaignRequestBody.md) | Specify the loyalty campaign details. | [optional] | + +### Return type + +[**LoyaltiesCreateCampaignResponseBody**](LoyaltiesCreateCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_points_expiration_export + +> create_points_expiration_export(campaign_id, opts) + +Create Points Expiration Export + +Schedule the generation of a points expiration CSV file for a particular campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. +opts = { + loyalties_points_expiration_export_create_request_body: VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBody.new # LoyaltiesPointsExpirationExportCreateRequestBody | Specify the data filters, types of data to return and order in which the results should be returned. +} + +begin + # Create Points Expiration Export + result = api_instance.create_points_expiration_export(campaign_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->create_points_expiration_export: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID or name. | | +| **loyalties_points_expiration_export_create_request_body** | [**LoyaltiesPointsExpirationExportCreateRequestBody**](LoyaltiesPointsExpirationExportCreateRequestBody.md) | Specify the data filters, types of data to return and order in which the results should be returned. | [optional] | + +### Return type + +[**LoyaltiesPointsExpirationExportCreateResponseBody**](LoyaltiesPointsExpirationExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_reward_assignment1 + +> create_reward_assignment1(campaign_id, opts) + +Create Reward Assignment + +Add rewards to a loyalty campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +opts = { + loyalties_rewards_create_assignment_item_request_body: [VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBody.new] # Array | Define the cost of the rewards in loyalty points. +} + +begin + # Create Reward Assignment + result = api_instance.create_reward_assignment1(campaign_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->create_reward_assignment1: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **loyalties_rewards_create_assignment_item_request_body** | [**Array<LoyaltiesRewardsCreateAssignmentItemRequestBody>**](LoyaltiesRewardsCreateAssignmentItemRequestBody.md) | Define the cost of the rewards in loyalty points. | [optional] | + +### Return type + +[**LoyaltiesRewardsCreateAssignmentResponseBody**](LoyaltiesRewardsCreateAssignmentResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_earning_rule + +> delete_earning_rule(campaign_id, earning_rule_id) + +Delete Earning Rule + +This method deletes an earning rule for a specific loyalty campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +earning_rule_id = 'earning_rule_id_example' # String | A unique earning rule ID. + +begin + # Delete Earning Rule + api_instance.delete_earning_rule(campaign_id, earning_rule_id) +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->delete_earning_rule: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **earning_rule_id** | **String** | A unique earning rule ID. | | + +### Return type + +nil (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## delete_loyalty_program + +> delete_loyalty_program(campaign_id, opts) + +Delete Loyalty Campaign + +Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +opts = { + force: true # Boolean | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. +} + +begin + # Delete Loyalty Campaign + result = api_instance.delete_loyalty_program(campaign_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->delete_loyalty_program: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **force** | **Boolean** | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. | [optional] | + +### Return type + +[**LoyaltiesDeleteResponseBody**](LoyaltiesDeleteResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## delete_reward_assignment1 + +> delete_reward_assignment1(campaign_id, assignment_id) + +Delete Reward Assignment + +This method deletes a reward assignment for a particular loyalty campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +assignment_id = 'assignment_id_example' # String | A unique reward assignment ID. + +begin + # Delete Reward Assignment + api_instance.delete_reward_assignment1(campaign_id, assignment_id) +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->delete_reward_assignment1: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignment_id** | **String** | A unique reward assignment ID. | | + +### Return type + +nil (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## disable_earning_rule + +> disable_earning_rule(campaign_id, earning_rule_id) + +Disable Earning Rule + +Disable an earning rule. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. +earning_rule_id = 'earning_rule_id_example' # String | Unique earning rule ID. + +begin + # Disable Earning Rule + result = api_instance.disable_earning_rule(campaign_id, earning_rule_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->disable_earning_rule: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID or name. | | +| **earning_rule_id** | **String** | Unique earning rule ID. | | + +### Return type + +[**LoyaltiesEarningRulesDisableResponseBody**](LoyaltiesEarningRulesDisableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## enable_earning_rule + +> enable_earning_rule(campaign_id, earning_rule_id) + +Enable Earning Rule + +Enable an earning rule. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. +earning_rule_id = 'earning_rule_id_example' # String | Unique earning rule ID. + +begin + # Enable Earning Rule + result = api_instance.enable_earning_rule(campaign_id, earning_rule_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->enable_earning_rule: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID or name. | | +| **earning_rule_id** | **String** | Unique earning rule ID. | | + +### Return type + +[**LoyaltiesEarningRulesEnableResponseBody**](LoyaltiesEarningRulesEnableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## export_loyalty_card_transactions + +> export_loyalty_card_transactions(member_id, opts) + +Export Loyalty Card Transactions + +Export transactions that are associated with point movements on a loyalty card. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to export transaction data for. +opts = { + loyalties_members_transactions_export_create_request_body: VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody.new # LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. +} + +begin + # Export Loyalty Card Transactions + result = api_instance.export_loyalty_card_transactions(member_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->export_loyalty_card_transactions: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to export transaction data for. | | +| **loyalties_members_transactions_export_create_request_body** | [**LoyaltiesMembersTransactionsExportCreateRequestBody**](LoyaltiesMembersTransactionsExportCreateRequestBody.md) | Specify the parameters and filters for the transaction export. | [optional] | + +### Return type + +[**LoyaltiesMembersTransactionsExportCreateResponseBody**](LoyaltiesMembersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## export_loyalty_card_transactions1 + +> export_loyalty_card_transactions1(campaign_id, member_id, opts) + +Export Loyalty Card Transactions + +Export transactions that are associated with point movements on a loyalty card. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. +member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to export transaction data for. +opts = { + loyalties_members_transactions_export_create_request_body: VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody.new # LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. +} + +begin + # Export Loyalty Card Transactions + result = api_instance.export_loyalty_card_transactions1(campaign_id, member_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->export_loyalty_card_transactions1: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. | | +| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to export transaction data for. | | +| **loyalties_members_transactions_export_create_request_body** | [**LoyaltiesMembersTransactionsExportCreateRequestBody**](LoyaltiesMembersTransactionsExportCreateRequestBody.md) | Specify the parameters and filters for the transaction export. | [optional] | + +### Return type + +[**LoyaltiesMembersTransactionsExportCreateResponseBody**](LoyaltiesMembersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## get_earning_rule + +> get_earning_rule(campaign_id, earning_rule_id) + +Get Earning Rule + +Retrieves an earning rule assigned to a campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +earning_rule_id = 'earning_rule_id_example' # String | A unique earning rule ID. + +begin + # Get Earning Rule + result = api_instance.get_earning_rule(campaign_id, earning_rule_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->get_earning_rule: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **earning_rule_id** | **String** | A unique earning rule ID. | | + +### Return type + +[**LoyaltiesEarningRulesGetResponseBody**](LoyaltiesEarningRulesGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_loyalty_program + +> get_loyalty_program(campaign_id) + +Get Loyalty Campaign + +Retrieve a specific loyalty campaign. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + +begin + # Get Loyalty Campaign + result = api_instance.get_loyalty_program(campaign_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->get_loyalty_program: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | + +### Return type + +[**LoyaltiesGetCampaignResponseBody**](LoyaltiesGetCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_loyalty_tier + +> get_loyalty_tier(campaign_id, loyalty_tier_id) + +Get Loyalty Tier + +Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique loyalty campaign ID or name. +loyalty_tier_id = 'loyalty_tier_id_example' # String | Unique loyalty tier ID. + +begin + # Get Loyalty Tier + result = api_instance.get_loyalty_tier(campaign_id, loyalty_tier_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->get_loyalty_tier: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique loyalty campaign ID or name. | | +| **loyalty_tier_id** | **String** | Unique loyalty tier ID. | | + +### Return type + +[**LoyaltiesTiersGetResponseBody**](LoyaltiesTiersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_member + +> get_member(member_id) + +Get Member + +Retrieve loyalty card with the given member ID (i.e. voucher code). 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +member_id = 'member_id_example' # String | Unique loyalty card code assigned to a particular customer. + +begin + # Get Member + result = api_instance.get_member(member_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->get_member: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **member_id** | **String** | Unique loyalty card code assigned to a particular customer. | | + +### Return type + +[**LoyaltiesMembersGetResponseBody**](LoyaltiesMembersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_member1 + +> get_member1(campaign_id, member_id) + +Get Member + +Retrieves the loyalty card with the given member ID (i.e. voucher code). + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID. +member_id = 'member_id_example' # String | Unique code that identifies the loyalty card. + +begin + # Get Member + result = api_instance.get_member1(campaign_id, member_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->get_member1: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID. | | +| **member_id** | **String** | Unique code that identifies the loyalty card. | | + +### Return type + +[**LoyaltiesMembersGetResponseBody**](LoyaltiesMembersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_reward_assignment1 + +> get_reward_assignment1(campaign_id, assignment_id) + +Get Reward Assignment + +Retrieve specific reward assignment. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::LoyaltiesApi.new +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +assignment_id = 'assignment_id_example' # String | Unique reward assignment ID. + +begin + # Get Reward Assignment + result = api_instance.get_reward_assignment1(campaign_id, assignment_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling LoyaltiesApi->get_reward_assignment1: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignment_id** | **String** | Unique reward assignment ID. | | + +### Return type + +[**LoyaltiesRewardAssignmentsGetResponseBody**](LoyaltiesRewardAssignmentsGetResponseBody.md) ### Authorization @@ -90,17 +1198,17 @@ end ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json -## delete_earning_rule +## get_reward_assignment2 -> delete_earning_rule(campaign_id, earning_rule_id) +> get_reward_assignment2(campaign_id, assignment_id) -Delete Earning Rule +Get Reward Assignment -This method deletes an earning rule for a specific loyalty campaign. +Retrieve specific reward assignment. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. ### Examples @@ -122,13 +1230,14 @@ end api_instance = VoucherifySdk::LoyaltiesApi.new campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -earning_rule_id = 'earning_rule_id_example' # String | A unique earning rule ID. +assignment_id = 'assignment_id_example' # String | A unique reward assignment ID. begin - # Delete Earning Rule - api_instance.delete_earning_rule(campaign_id, earning_rule_id) + # Get Reward Assignment + result = api_instance.get_reward_assignment2(campaign_id, assignment_id) + p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->delete_earning_rule: #{e}" + puts "Error when calling LoyaltiesApi->get_reward_assignment2: #{e}" end ``` @@ -137,11 +1246,11 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **earning_rule_id** | **String** | A unique earning rule ID. | | +| **assignment_id** | **String** | A unique reward assignment ID. | | ### Return type -nil (empty response body) +[**LoyaltiesRewardsGetResponseBody**](LoyaltiesRewardsGetResponseBody.md) ### Authorization @@ -150,16 +1259,16 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json -## delete_loyalty_program +## get_reward_details -> delete_loyalty_program(campaign_id, opts) +> get_reward_details(campaign_id, assignment_id) -Delete Loyalty Campaign +Get Reward Details -This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. +Get reward details in the context of a loyalty campaign and reward assignment ID. ### Examples @@ -181,16 +1290,14 @@ end api_instance = VoucherifySdk::LoyaltiesApi.new campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -opts = { - force: true # Boolean | If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name. -} +assignment_id = 'assignment_id_example' # String | Unique reward assignment ID. begin - # Delete Loyalty Campaign - result = api_instance.delete_loyalty_program(campaign_id, opts) + # Get Reward Details + result = api_instance.get_reward_details(campaign_id, assignment_id) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->delete_loyalty_program: #{e}" + puts "Error when calling LoyaltiesApi->get_reward_details: #{e}" end ``` @@ -199,11 +1306,11 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **force** | **Boolean** | If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name. | [optional] | +| **assignment_id** | **String** | Unique reward assignment ID. | | ### Return type -[**LoyaltiesDeleteResponseBody**](LoyaltiesDeleteResponseBody.md) +[**LoyaltiesRewardAssignmentsRewardGetResponseBody**](LoyaltiesRewardAssignmentsRewardGetResponseBody.md) ### Authorization @@ -215,13 +1322,13 @@ end - **Accept**: application/json -## delete_reward_assignment1 +## list_earning_rules -> delete_reward_assignment1(campaign_id, assignment_id) +> list_earning_rules(campaign_id, opts) -Delete Reward Assignment +List Earning Rules -This method deletes a reward assignment for a particular loyalty campaign. +Returns a list of all earning rules within a given campaign. ### Examples @@ -243,13 +1350,18 @@ end api_instance = VoucherifySdk::LoyaltiesApi.new campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -assignment_id = 'assignment_id_example' # String | A unique reward assignment ID. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + order: VoucherifySdk::ParameterOrderListEarningRules::CREATED_AT # ParameterOrderListEarningRules | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +} begin - # Delete Reward Assignment - api_instance.delete_reward_assignment1(campaign_id, assignment_id) + # List Earning Rules + result = api_instance.list_earning_rules(campaign_id, opts) + p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->delete_reward_assignment1: #{e}" + puts "Error when calling LoyaltiesApi->list_earning_rules: #{e}" end ``` @@ -258,11 +1370,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **assignment_id** | **String** | A unique reward assignment ID. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListEarningRules**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type -nil (empty response body) +[**LoyaltiesEarningRulesListResponseBody**](LoyaltiesEarningRulesListResponseBody.md) ### Authorization @@ -271,16 +1385,16 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json -## disable_earning_rule +## list_loyalty_card_transactions -> disable_earning_rule(campaign_id, earning_rule_id) +> list_loyalty_card_transactions(member_id, opts) -Disable Earning Rule +List Loyalty Card Transactions -Disable an earning rule. +Retrieve transaction data related to point movements for a specific loyalty card. ### Examples @@ -301,15 +1415,17 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. -earning_rule_id = 'earning_rule_id_example' # String | Unique earning rule ID. +member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. +opts = { + limit: 56 # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +} begin - # Disable Earning Rule - result = api_instance.disable_earning_rule(campaign_id, earning_rule_id) + # List Loyalty Card Transactions + result = api_instance.list_loyalty_card_transactions(member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->disable_earning_rule: #{e}" + puts "Error when calling LoyaltiesApi->list_loyalty_card_transactions: #{e}" end ``` @@ -317,12 +1433,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique campaign ID or name. | | -| **earning_rule_id** | **String** | Unique earning rule ID. | | +| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | ### Return type -[**LoyaltiesEarningRulesDisableResponseBody**](LoyaltiesEarningRulesDisableResponseBody.md) +[**LoyaltiesMembersTransactionsListResponseBody**](LoyaltiesMembersTransactionsListResponseBody.md) ### Authorization @@ -334,13 +1450,13 @@ end - **Accept**: application/json -## enable_earning_rule +## list_loyalty_card_transactions1 -> enable_earning_rule(campaign_id, earning_rule_id) +> list_loyalty_card_transactions1(campaign_id, member_id, opts) -Enable Earning Rule +List Loyalty Card Transactions -Enable an earning rule. +Retrieve transaction data related to point movements for a specific loyalty card. ### Examples @@ -361,15 +1477,19 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. -earning_rule_id = 'earning_rule_id_example' # String | Unique earning rule ID. +campaign_id = 'campaign_id_example' # String | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. +member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56 # Integer | Which page of results to return. The lowest value is 1. +} begin - # Enable Earning Rule - result = api_instance.enable_earning_rule(campaign_id, earning_rule_id) + # List Loyalty Card Transactions + result = api_instance.list_loyalty_card_transactions1(campaign_id, member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->enable_earning_rule: #{e}" + puts "Error when calling LoyaltiesApi->list_loyalty_card_transactions1: #{e}" end ``` @@ -377,12 +1497,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique campaign ID or name. | | -| **earning_rule_id** | **String** | Unique earning rule ID. | | +| **campaign_id** | **String** | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. | | +| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | ### Return type -[**LoyaltiesEarningRulesEnableResponseBody**](LoyaltiesEarningRulesEnableResponseBody.md) +[**LoyaltiesMembersTransactionsListResponseBody**](LoyaltiesMembersTransactionsListResponseBody.md) ### Authorization @@ -394,13 +1516,13 @@ end - **Accept**: application/json -## export_loyalty_card_transactions +## list_loyalty_programs -> export_loyalty_card_transactions(member_id, opts) +> list_loyalty_programs(opts) -Export Loyalty Card Transactions +List Loyalty Campaigns -Export transactions that are associated with point movements on a loyalty card. +Returns a list of your loyalty campaigns. ### Examples @@ -421,17 +1543,18 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to export transaction data for. opts = { - loyalties_members_transactions_export_create_request_body: VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody.new # LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + order: VoucherifySdk::ParameterOrderListCampaigns::CREATED_AT # ParameterOrderListCampaigns | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. } begin - # Export Loyalty Card Transactions - result = api_instance.export_loyalty_card_transactions(member_id, opts) + # List Loyalty Campaigns + result = api_instance.list_loyalty_programs(opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->export_loyalty_card_transactions: #{e}" + puts "Error when calling LoyaltiesApi->list_loyalty_programs: #{e}" end ``` @@ -439,12 +1562,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to export transaction data for. | | -| **loyalties_members_transactions_export_create_request_body** | [**LoyaltiesMembersTransactionsExportCreateRequestBody**](LoyaltiesMembersTransactionsExportCreateRequestBody.md) | Specify the parameters and filters for the transaction export. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListCampaigns**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type -[**LoyaltiesMembersTransactionsExportCreateResponseBody**](LoyaltiesMembersTransactionsExportCreateResponseBody.md) +[**LoyaltiesListCampaignsResponseBody**](LoyaltiesListCampaignsResponseBody.md) ### Authorization @@ -452,17 +1576,17 @@ end ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json -## export_loyalty_card_transactions1 +## list_loyalty_tier_earning_rules -> export_loyalty_card_transactions1(campaign_id, member_id, opts) +> list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts) -Export Loyalty Card Transactions +List Loyalty Tier Earning Rules -Export transactions that are associated with point movements on a loyalty card. +Retrieve available earning rules for a given tier and the calculation method for earning points. ### Examples @@ -483,18 +1607,19 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. -member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to export transaction data for. +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. +loyalty_tier_id = 'loyalty_tier_id_example' # String | Unique loyalty tier ID. opts = { - loyalties_members_transactions_export_create_request_body: VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody.new # LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56 # Integer | Which page of results to return. The lowest value is 1. } begin - # Export Loyalty Card Transactions - result = api_instance.export_loyalty_card_transactions1(campaign_id, member_id, opts) + # List Loyalty Tier Earning Rules + result = api_instance.list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->export_loyalty_card_transactions1: #{e}" + puts "Error when calling LoyaltiesApi->list_loyalty_tier_earning_rules: #{e}" end ``` @@ -502,13 +1627,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. | | -| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to export transaction data for. | | -| **loyalties_members_transactions_export_create_request_body** | [**LoyaltiesMembersTransactionsExportCreateRequestBody**](LoyaltiesMembersTransactionsExportCreateRequestBody.md) | Specify the parameters and filters for the transaction export. | [optional] | +| **campaign_id** | **String** | Unique campaign ID or name. | | +| **loyalty_tier_id** | **String** | Unique loyalty tier ID. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | ### Return type -[**LoyaltiesMembersTransactionsExportCreateResponseBody**](LoyaltiesMembersTransactionsExportCreateResponseBody.md) +[**LoyaltiesTiersEarningRulesListResponseBody**](LoyaltiesTiersEarningRulesListResponseBody.md) ### Authorization @@ -516,17 +1642,17 @@ end ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json -## get_earning_rule +## list_loyalty_tier_rewards -> get_earning_rule(campaign_id, earning_rule_id) +> list_loyalty_tier_rewards(campaign_id, loyalty_tier_id) -Get Earning Rule +List Loyalty Tier Rewards -Retrieves an earning rule assigned to a campaign. +Get available rewards for a given tier. ### Examples @@ -547,15 +1673,15 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -earning_rule_id = 'earning_rule_id_example' # String | A unique earning rule ID. +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. +loyalty_tier_id = 'loyalty_tier_id_example' # String | Unique loyalty tier ID. begin - # Get Earning Rule - result = api_instance.get_earning_rule(campaign_id, earning_rule_id) + # List Loyalty Tier Rewards + result = api_instance.list_loyalty_tier_rewards(campaign_id, loyalty_tier_id) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->get_earning_rule: #{e}" + puts "Error when calling LoyaltiesApi->list_loyalty_tier_rewards: #{e}" end ``` @@ -563,12 +1689,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **earning_rule_id** | **String** | A unique earning rule ID. | | +| **campaign_id** | **String** | Unique campaign ID or name. | | +| **loyalty_tier_id** | **String** | Unique loyalty tier ID. | | ### Return type -[**LoyaltiesEarningRulesGetResponseBody**](LoyaltiesEarningRulesGetResponseBody.md) +[**LoyaltiesTiersRewardsListResponseBody**](LoyaltiesTiersRewardsListResponseBody.md) ### Authorization @@ -580,13 +1706,13 @@ end - **Accept**: application/json -## get_loyalty_tier +## list_loyalty_tiers -> get_loyalty_tier(campaign_id, loyalty_tier_id) +> list_loyalty_tiers(campaign_id, opts) -Get Loyalty Tier +List Loyalty Tiers -Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. +Retrieve a list of loyalty tiers which were added to the loyalty program. ### Examples @@ -608,14 +1734,17 @@ end api_instance = VoucherifySdk::LoyaltiesApi.new campaign_id = 'campaign_id_example' # String | Unique loyalty campaign ID or name. -loyalty_tier_id = 'loyalty_tier_id_example' # String | Unique loyalty tier ID. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + order: VoucherifySdk::ParameterOrderListLoyaltyTiers::CREATED_AT # ParameterOrderListLoyaltyTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +} begin - # Get Loyalty Tier - result = api_instance.get_loyalty_tier(campaign_id, loyalty_tier_id) + # List Loyalty Tiers + result = api_instance.list_loyalty_tiers(campaign_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->get_loyalty_tier: #{e}" + puts "Error when calling LoyaltiesApi->list_loyalty_tiers: #{e}" end ``` @@ -624,11 +1753,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **campaign_id** | **String** | Unique loyalty campaign ID or name. | | -| **loyalty_tier_id** | **String** | Unique loyalty tier ID. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderListLoyaltyTiers**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type -[**LoyaltiesTiersGetResponseBody**](LoyaltiesTiersGetResponseBody.md) +[**LoyaltiesTiersListResponseBody**](LoyaltiesTiersListResponseBody.md) ### Authorization @@ -640,13 +1770,13 @@ end - **Accept**: application/json -## get_reward_assignment1 +## list_member_activity -> get_reward_assignment1(campaign_id, assignment_id) +> list_member_activity(member_id, opts) -Get Reward Assignment +List Member Activity -Retrieve specific reward assignment. + 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. ### Examples @@ -667,15 +1797,19 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -assignment_id = 'assignment_id_example' # String | Unique reward assignment ID. +member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + order: VoucherifySdk::ParameterOrderCreatedAt::CREATED_AT, # ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + starting_after_id: 'starting_after_id_example' # String | A cursor for pagination. It retrieves the events starting after an event with the given ID. +} begin - # Get Reward Assignment - result = api_instance.get_reward_assignment1(campaign_id, assignment_id) + # List Member Activity + result = api_instance.list_member_activity(member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->get_reward_assignment1: #{e}" + puts "Error when calling LoyaltiesApi->list_member_activity: #{e}" end ``` @@ -683,12 +1817,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **assignment_id** | **String** | Unique reward assignment ID. | | +| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderCreatedAt**](.md) | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **starting_after_id** | **String** | A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | ### Return type -[**LoyaltiesRewardAssignmentsGetResponseBody**](LoyaltiesRewardAssignmentsGetResponseBody.md) +[**LoyaltiesMemberActivityListResponseBody**](LoyaltiesMemberActivityListResponseBody.md) ### Authorization @@ -700,13 +1836,13 @@ end - **Accept**: application/json -## get_reward_assignment2 +## list_member_activity1 -> get_reward_assignment2(campaign_id, assignment_id) +> list_member_activity1(campaign_id, member_id, opts) -Get Reward Assignment +List Member Activity -Retrieve specific reward assignment. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. +Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. ### Examples @@ -727,15 +1863,20 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -assignment_id = 'assignment_id_example' # String | A unique reward assignment ID. +campaign_id = 'campaign_id_example' # String | Unique campaign ID. +member_id = 'member_id_example' # String | A code that identifies the loyalty card. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + order: VoucherifySdk::ParameterOrderCreatedAt::CREATED_AT, # ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + starting_after_id: 'starting_after_id_example' # String | A cursor for pagination. It retrieves the events starting after an event with the given ID. +} begin - # Get Reward Assignment - result = api_instance.get_reward_assignment2(campaign_id, assignment_id) + # List Member Activity + result = api_instance.list_member_activity1(campaign_id, member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->get_reward_assignment2: #{e}" + puts "Error when calling LoyaltiesApi->list_member_activity1: #{e}" end ``` @@ -743,12 +1884,15 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **assignment_id** | **String** | A unique reward assignment ID. | | +| **campaign_id** | **String** | Unique campaign ID. | | +| **member_id** | **String** | A code that identifies the loyalty card. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderCreatedAt**](.md) | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **starting_after_id** | **String** | A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | ### Return type -[**LoyaltiesRewardsGetResponseBody**](LoyaltiesRewardsGetResponseBody.md) +[**LoyaltiesMemberActivityListResponseBody**](LoyaltiesMemberActivityListResponseBody.md) ### Authorization @@ -760,13 +1904,13 @@ end - **Accept**: application/json -## get_reward_details +## list_member_loyalty_tier -> get_reward_details(campaign_id, assignment_id) +> list_member_loyalty_tier(member_id) -Get Reward Details +List Member's Loyalty Tiers -Get reward details in the context of a loyalty campaign and reward assignment ID. +Retrieve member tiers using the loyalty card ID. ### Examples @@ -787,15 +1931,14 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -assignment_id = 'assignment_id_example' # String | Unique reward assignment ID. +member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. begin - # Get Reward Details - result = api_instance.get_reward_details(campaign_id, assignment_id) + # List Member's Loyalty Tiers + result = api_instance.list_member_loyalty_tier(member_id) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->get_reward_details: #{e}" + puts "Error when calling LoyaltiesApi->list_member_loyalty_tier: #{e}" end ``` @@ -803,12 +1946,11 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **assignment_id** | **String** | Unique reward assignment ID. | | +| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | ### Return type -[**LoyaltiesRewardAssignmentsRewardGetResponseBody**](LoyaltiesRewardAssignmentsRewardGetResponseBody.md) +[**LoyaltiesMembersTiersListResponseBody**](LoyaltiesMembersTiersListResponseBody.md) ### Authorization @@ -820,13 +1962,13 @@ end - **Accept**: application/json -## list_loyalty_card_transactions +## list_member_rewards -> list_loyalty_card_transactions(member_id, opts) +> list_member_rewards(member_id, opts) -List Loyalty Card Transactions +List Member Rewards -Retrieve transaction data related to point movements for a specific loyalty card. +Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. ### Examples @@ -847,18 +1989,17 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. +member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56 # Integer | Which page of results to return. + affordable_only: true # Boolean | Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. } begin - # List Loyalty Card Transactions - result = api_instance.list_loyalty_card_transactions(member_id, opts) + # List Member Rewards + result = api_instance.list_member_rewards(member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_loyalty_card_transactions: #{e}" + puts "Error when calling LoyaltiesApi->list_member_rewards: #{e}" end ``` @@ -866,13 +2007,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | +| **affordable_only** | **Boolean** | Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. | [optional] | ### Return type -[**LoyaltiesMembersTransactionsListResponseBody**](LoyaltiesMembersTransactionsListResponseBody.md) +[**LoyaltiesMembersRewardsListResponseBody**](LoyaltiesMembersRewardsListResponseBody.md) ### Authorization @@ -884,13 +2024,13 @@ end - **Accept**: application/json -## list_loyalty_card_transactions1 +## list_members -> list_loyalty_card_transactions1(campaign_id, member_id, opts) +> list_members(campaign_id, opts) -List Loyalty Card Transactions +List Members -Retrieve transaction data related to point movements for a specific loyalty card. +Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. ### Examples @@ -911,19 +2051,24 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. -member_id = 'member_id_example' # String | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. +campaign_id = 'campaign_id_example' # String | Unique campaign ID of the loyalty program. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56 # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + customer: 'customer_example', # String | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + created_at: VoucherifySdk::ParameterCreatedBeforeAfter.new, # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + updated_at: VoucherifySdk::ParameterUpdatedBeforeAfter.new, # ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + order: VoucherifySdk::ParameterOrderVouchers::CREATED_AT, # ParameterOrderVouchers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + code: 'code_example', # String | + ids: ['inner_example'] # Array | } begin - # List Loyalty Card Transactions - result = api_instance.list_loyalty_card_transactions1(campaign_id, member_id, opts) + # List Members + result = api_instance.list_members(campaign_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_loyalty_card_transactions1: #{e}" + puts "Error when calling LoyaltiesApi->list_members: #{e}" end ``` @@ -931,14 +2076,19 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. | | -| **member_id** | **String** | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **campaign_id** | **String** | Unique campaign ID of the loyalty program. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **customer** | **String** | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. | [optional] | +| **created_at** | [**ParameterCreatedBeforeAfter**](.md) | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **updated_at** | [**ParameterUpdatedBeforeAfter**](.md) | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **order** | [**ParameterOrderVouchers**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **code** | **String** | | [optional] | +| **ids** | [**Array<String>**](String.md) | | [optional] | ### Return type -[**LoyaltiesMembersTransactionsListResponseBody**](LoyaltiesMembersTransactionsListResponseBody.md) +[**LoyaltiesListMembersResponseBody**](LoyaltiesListMembersResponseBody.md) ### Authorization @@ -950,13 +2100,13 @@ end - **Accept**: application/json -## list_loyalty_tier_earning_rules +## list_points_expiration -> list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts) +> list_points_expiration(campaign_id, member_id, opts) -List Loyalty Tier Earning Rules +Get Points Expiration -Retrieve available earning rules for a given tier and the calculation method for earning points. +Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. ### Examples @@ -977,19 +2127,19 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. -loyalty_tier_id = 'loyalty_tier_id_example' # String | Unique loyalty tier ID. +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +member_id = 'member_id_example' # String | Loyalty card code. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56 # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56 # Integer | Which page of results to return. The lowest value is 1. } begin - # List Loyalty Tier Earning Rules - result = api_instance.list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts) + # Get Points Expiration + result = api_instance.list_points_expiration(campaign_id, member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_loyalty_tier_earning_rules: #{e}" + puts "Error when calling LoyaltiesApi->list_points_expiration: #{e}" end ``` @@ -997,14 +2147,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique campaign ID or name. | | -| **loyalty_tier_id** | **String** | Unique loyalty tier ID. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **member_id** | **String** | Loyalty card code. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | ### Return type -[**LoyaltiesTiersEarningRulesListResponseBody**](LoyaltiesTiersEarningRulesListResponseBody.md) +[**LoyaltiesMembersPointsExpirationListResponseBody**](LoyaltiesMembersPointsExpirationListResponseBody.md) ### Authorization @@ -1016,13 +2166,13 @@ end - **Accept**: application/json -## list_loyalty_tier_rewards +## list_reward_assignments1 -> list_loyalty_tier_rewards(campaign_id, loyalty_tier_id) +> list_reward_assignments1(campaign_id, opts) -List Loyalty Tier Rewards +List Reward Assignments -Get available rewards for a given tier. +Returns reward assignments from a given loyalty campaign. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. ### Examples @@ -1043,15 +2193,19 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique campaign ID or name. -loyalty_tier_id = 'loyalty_tier_id_example' # String | Unique loyalty tier ID. +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + assignment_id: 'assignment_id_example' # String | A unique reward assignment ID. +} begin - # List Loyalty Tier Rewards - result = api_instance.list_loyalty_tier_rewards(campaign_id, loyalty_tier_id) + # List Reward Assignments + result = api_instance.list_reward_assignments1(campaign_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_loyalty_tier_rewards: #{e}" + puts "Error when calling LoyaltiesApi->list_reward_assignments1: #{e}" end ``` @@ -1059,12 +2213,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique campaign ID or name. | | -| **loyalty_tier_id** | **String** | Unique loyalty tier ID. | | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **assignment_id** | **String** | A unique reward assignment ID. | [optional] | ### Return type -[**LoyaltiesTiersRewardsListResponseBody**](LoyaltiesTiersRewardsListResponseBody.md) +[**LoyaltiesRewardAssignmentsListResponseBody**](LoyaltiesRewardAssignmentsListResponseBody.md) ### Authorization @@ -1076,13 +2232,13 @@ end - **Accept**: application/json -## list_loyalty_tiers +## list_reward_assignments2 -> list_loyalty_tiers(campaign_id, opts) +> list_reward_assignments2(campaign_id, opts) -List Loyalty Tiers +List Reward Assignments -Retrieve a list of loyalty tiers which were added to the loyalty program. +Returns active rewards from a given loyalty campaign. ### Examples @@ -1103,18 +2259,19 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique loyalty campaign ID or name. +campaign_id = 'campaign_id_example' # String | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - order: VoucherifySdk::ParameterOrderListLoyaltyTiers::CREATED_AT # ParameterOrderListLoyaltyTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + assignment_id: 'assignment_id_example' # String | A unique reward assignment ID. } begin - # List Loyalty Tiers - result = api_instance.list_loyalty_tiers(campaign_id, opts) + # List Reward Assignments + result = api_instance.list_reward_assignments2(campaign_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_loyalty_tiers: #{e}" + puts "Error when calling LoyaltiesApi->list_reward_assignments2: #{e}" end ``` @@ -1122,13 +2279,14 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique loyalty campaign ID or name. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **order** | [**ParameterOrderListLoyaltyTiers**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **campaign_id** | **String** | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **assignment_id** | **String** | A unique reward assignment ID. | [optional] | ### Return type -[**LoyaltiesTiersListResponseBody**](LoyaltiesTiersListResponseBody.md) +[**LoyaltiesRewardsListAssignmentsResponseBody**](LoyaltiesRewardsListAssignmentsResponseBody.md) ### Authorization @@ -1140,13 +2298,13 @@ end - **Accept**: application/json -## list_member_loyalty_tier +## redeem_reward -> list_member_loyalty_tier(member_id) +> redeem_reward(member_id, opts) -List Member's Loyalty Tiers +Redeem Reward -Retrieve member tiers using the loyalty card ID. + 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. ### Examples @@ -1168,13 +2326,16 @@ end api_instance = VoucherifySdk::LoyaltiesApi.new member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. +opts = { + loyalties_members_redemption_redeem_request_body: VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody.new # LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. +} begin - # List Member's Loyalty Tiers - result = api_instance.list_member_loyalty_tier(member_id) + # Redeem Reward + result = api_instance.redeem_reward(member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_member_loyalty_tier: #{e}" + puts "Error when calling LoyaltiesApi->redeem_reward: #{e}" end ``` @@ -1183,10 +2344,11 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | +| **loyalties_members_redemption_redeem_request_body** | [**LoyaltiesMembersRedemptionRedeemRequestBody**](LoyaltiesMembersRedemptionRedeemRequestBody.md) | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] | ### Return type -[**LoyaltiesMembersTiersListResponseBody**](LoyaltiesMembersTiersListResponseBody.md) +[**LoyaltiesMembersRedemptionRedeemResponseBody**](LoyaltiesMembersRedemptionRedeemResponseBody.md) ### Authorization @@ -1194,17 +2356,17 @@ end ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json -## list_member_rewards +## redeem_reward1 -> list_member_rewards(member_id, opts) +> redeem_reward1(campaign_id, member_id, opts) -List Member Rewards +Redeem Reward -Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. +Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. ### Examples @@ -1225,17 +2387,18 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. +campaign_id = 'campaign_id_example' # String | Unique campaign ID. +member_id = 'member_id_example' # String | A code that identifies the loyalty card. opts = { - affordable_only: true # Boolean | Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + loyalties_members_redemption_redeem_request_body: VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody.new # LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. } begin - # List Member Rewards - result = api_instance.list_member_rewards(member_id, opts) + # Redeem Reward + result = api_instance.redeem_reward1(campaign_id, member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_member_rewards: #{e}" + puts "Error when calling LoyaltiesApi->redeem_reward1: #{e}" end ``` @@ -1243,12 +2406,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | -| **affordable_only** | **Boolean** | Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. | [optional] | +| **campaign_id** | **String** | Unique campaign ID. | | +| **member_id** | **String** | A code that identifies the loyalty card. | | +| **loyalties_members_redemption_redeem_request_body** | [**LoyaltiesMembersRedemptionRedeemRequestBody**](LoyaltiesMembersRedemptionRedeemRequestBody.md) | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] | ### Return type -[**LoyaltiesMembersRewardsListResponseBody**](LoyaltiesMembersRewardsListResponseBody.md) +[**LoyaltiesMembersRedemptionRedeemResponseBody**](LoyaltiesMembersRedemptionRedeemResponseBody.md) ### Authorization @@ -1256,17 +2420,17 @@ end ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json -## list_points_expiration +## transfer_points -> list_points_expiration(campaign_id, member_id, opts) +> transfer_points(campaign_id, member_id, opts) -Get Points Expiration +Transfer Loyalty Points -Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. +Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. ### Examples @@ -1287,19 +2451,18 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. -member_id = 'member_id_example' # String | Loyalty card code. +campaign_id = 'campaign_id_example' # String | A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). +member_id = 'member_id_example' # String | A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56 # Integer | Which page of results to return. + loyalties_transfer_points: [VoucherifySdk::LoyaltiesTransferPoints.new] # Array | Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. } begin - # Get Points Expiration - result = api_instance.list_points_expiration(campaign_id, member_id, opts) + # Transfer Loyalty Points + result = api_instance.transfer_points(campaign_id, member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->list_points_expiration: #{e}" + puts "Error when calling LoyaltiesApi->transfer_points: #{e}" end ``` @@ -1307,14 +2470,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | -| **member_id** | **String** | Loyalty card code. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **campaign_id** | **String** | A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). | | +| **member_id** | **String** | A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). | | +| **loyalties_transfer_points** | [**Array<LoyaltiesTransferPoints>**](LoyaltiesTransferPoints.md) | Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. | [optional] | ### Return type -[**LoyaltiesMembersPointsExpirationListResponseBody**](LoyaltiesMembersPointsExpirationListResponseBody.md) +[**LoyaltiesMembersTransfersCreateResponseBody**](LoyaltiesMembersTransfersCreateResponseBody.md) ### Authorization @@ -1322,17 +2484,17 @@ end ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json -## redeem_reward +## update_earning_rule -> redeem_reward(member_id, opts) +> update_earning_rule(campaign_id, earning_rule_id, opts) -Redeem Reward +Update Earning Rule - 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. +Update an earning rule definition. ### Examples @@ -1353,17 +2515,18 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +earning_rule_id = 'earning_rule_id_example' # String | A unique earning rule ID. opts = { - loyalties_members_redemption_redeem_request_body: VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody.new # LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + loyalties_earning_rules_update_request_body: VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBody.new # LoyaltiesEarningRulesUpdateRequestBody | Specify the parameters that you would like to update for the given earning rule. } begin - # Redeem Reward - result = api_instance.redeem_reward(member_id, opts) + # Update Earning Rule + result = api_instance.update_earning_rule(campaign_id, earning_rule_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->redeem_reward: #{e}" + puts "Error when calling LoyaltiesApi->update_earning_rule: #{e}" end ``` @@ -1371,12 +2534,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | -| **loyalties_members_redemption_redeem_request_body** | [**LoyaltiesMembersRedemptionRedeemRequestBody**](LoyaltiesMembersRedemptionRedeemRequestBody.md) | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **earning_rule_id** | **String** | A unique earning rule ID. | | +| **loyalties_earning_rules_update_request_body** | [**LoyaltiesEarningRulesUpdateRequestBody**](LoyaltiesEarningRulesUpdateRequestBody.md) | Specify the parameters that you would like to update for the given earning rule. | [optional] | ### Return type -[**LoyaltiesMembersRedemptionRedeemResponseBody**](LoyaltiesMembersRedemptionRedeemResponseBody.md) +[**LoyaltiesEarningRulesUpdateResponseBody**](LoyaltiesEarningRulesUpdateResponseBody.md) ### Authorization @@ -1388,13 +2552,13 @@ end - **Accept**: application/json -## redeem_reward1 +## update_loyalty_card_balance -> redeem_reward1(campaign_id, member_id, opts) +> update_loyalty_card_balance(member_id, opts) -Redeem Reward +Add or Remove Loyalty Card Balance -Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. +This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. ### Examples @@ -1415,18 +2579,17 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique campaign ID. -member_id = 'member_id_example' # String | A code that identifies the loyalty card. +member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. opts = { - loyalties_members_redemption_redeem_request_body: VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody.new # LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + loyalties_members_balance_update_request_body: VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody.new # LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. } begin - # Redeem Reward - result = api_instance.redeem_reward1(campaign_id, member_id, opts) + # Add or Remove Loyalty Card Balance + result = api_instance.update_loyalty_card_balance(member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->redeem_reward1: #{e}" + puts "Error when calling LoyaltiesApi->update_loyalty_card_balance: #{e}" end ``` @@ -1434,13 +2597,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique campaign ID. | | -| **member_id** | **String** | A code that identifies the loyalty card. | | -| **loyalties_members_redemption_redeem_request_body** | [**LoyaltiesMembersRedemptionRedeemRequestBody**](LoyaltiesMembersRedemptionRedeemRequestBody.md) | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] | +| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | +| **loyalties_members_balance_update_request_body** | [**LoyaltiesMembersBalanceUpdateRequestBody**](LoyaltiesMembersBalanceUpdateRequestBody.md) | Specify the point adjustment along with the expiration mechanism. | [optional] | ### Return type -[**LoyaltiesMembersRedemptionRedeemResponseBody**](LoyaltiesMembersRedemptionRedeemResponseBody.md) +[**LoyaltiesMembersBalanceUpdateResponseBody**](LoyaltiesMembersBalanceUpdateResponseBody.md) ### Authorization @@ -1452,13 +2614,13 @@ end - **Accept**: application/json -## transfer_points +## update_loyalty_card_balance1 -> transfer_points(campaign_id, member_id, opts) +> update_loyalty_card_balance1(campaign_id, member_id, opts) -Transfer Loyalty Points +Add or Remove Loyalty Card Balance -Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. +This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. ### Examples @@ -1479,18 +2641,18 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). -member_id = 'member_id_example' # String | A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). +campaign_id = 'campaign_id_example' # String | Unique campaign ID. +member_id = 'member_id_example' # String | A code that identifies the loyalty card. opts = { - loyalties_transfer_points: [VoucherifySdk::LoyaltiesTransferPoints.new({code: 'code_example', points: 37, source_id: 'source_id_example'})] # Array | Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + loyalties_members_balance_update_request_body: VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody.new # LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. } begin - # Transfer Loyalty Points - result = api_instance.transfer_points(campaign_id, member_id, opts) + # Add or Remove Loyalty Card Balance + result = api_instance.update_loyalty_card_balance1(campaign_id, member_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->transfer_points: #{e}" + puts "Error when calling LoyaltiesApi->update_loyalty_card_balance1: #{e}" end ``` @@ -1498,13 +2660,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). | | -| **member_id** | **String** | A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). | | -| **loyalties_transfer_points** | [**Array<LoyaltiesTransferPoints>**](LoyaltiesTransferPoints.md) | Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. | [optional] | +| **campaign_id** | **String** | Unique campaign ID. | | +| **member_id** | **String** | A code that identifies the loyalty card. | | +| **loyalties_members_balance_update_request_body** | [**LoyaltiesMembersBalanceUpdateRequestBody**](LoyaltiesMembersBalanceUpdateRequestBody.md) | Specify the point adjustment along with the expiration mechanism. | [optional] | ### Return type -[**LoyaltiesMembersTransfersCreateResponseBody**](LoyaltiesMembersTransfersCreateResponseBody.md) +[**LoyaltiesMembersBalanceUpdateResponseBody**](LoyaltiesMembersBalanceUpdateResponseBody.md) ### Authorization @@ -1516,13 +2678,13 @@ end - **Accept**: application/json -## update_loyalty_card_balance +## update_loyalty_program -> update_loyalty_card_balance(member_id, opts) +> update_loyalty_program(campaign_id, opts) -Add or Remove Loyalty Card Balance +Update Loyalty Campaign -This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. +Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. ### Examples @@ -1543,17 +2705,17 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -member_id = 'member_id_example' # String | Unique loyalty card assigned to a particular customer. +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. opts = { - loyalties_members_balance_update_request_body: VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody.new({points: 37}) # LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. + loyalties_update_campaign_request_body: VoucherifySdk::LoyaltiesUpdateCampaignRequestBody.new # LoyaltiesUpdateCampaignRequestBody | Specify the new values for the parameters that you would like to update for the given loyalty campaign. } begin - # Add or Remove Loyalty Card Balance - result = api_instance.update_loyalty_card_balance(member_id, opts) + # Update Loyalty Campaign + result = api_instance.update_loyalty_program(campaign_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->update_loyalty_card_balance: #{e}" + puts "Error when calling LoyaltiesApi->update_loyalty_program: #{e}" end ``` @@ -1561,12 +2723,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **member_id** | **String** | Unique loyalty card assigned to a particular customer. | | -| **loyalties_members_balance_update_request_body** | [**LoyaltiesMembersBalanceUpdateRequestBody**](LoyaltiesMembersBalanceUpdateRequestBody.md) | Specify the point adjustment along with the expiration mechanism. | [optional] | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **loyalties_update_campaign_request_body** | [**LoyaltiesUpdateCampaignRequestBody**](LoyaltiesUpdateCampaignRequestBody.md) | Specify the new values for the parameters that you would like to update for the given loyalty campaign. | [optional] | ### Return type -[**LoyaltiesMembersBalanceUpdateResponseBody**](LoyaltiesMembersBalanceUpdateResponseBody.md) +[**LoyaltiesUpdateCampaignResponseBody**](LoyaltiesUpdateCampaignResponseBody.md) ### Authorization @@ -1578,13 +2740,13 @@ end - **Accept**: application/json -## update_loyalty_card_balance1 +## update_reward_assignment1 -> update_loyalty_card_balance1(campaign_id, member_id, opts) +> update_reward_assignment1(campaign_id, assignment_id, opts) -Add or Remove Loyalty Card Balance +Update Reward Assignment -This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. +Updates rewards parameters, i.e. the points cost for the specific reward. ### Examples @@ -1605,18 +2767,18 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::LoyaltiesApi.new -campaign_id = 'campaign_id_example' # String | Unique campaign ID. -member_id = 'member_id_example' # String | A code that identifies the loyalty card. +campaign_id = 'campaign_id_example' # String | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +assignment_id = 'assignment_id_example' # String | A unique reward assignment ID. opts = { - loyalties_members_balance_update_request_body: VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody.new({points: 37}) # LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. + loyalties_rewards_update_assignment_request_body: VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBody.new # LoyaltiesRewardsUpdateAssignmentRequestBody | Update the points cost for the reward assignment. } begin - # Add or Remove Loyalty Card Balance - result = api_instance.update_loyalty_card_balance1(campaign_id, member_id, opts) + # Update Reward Assignment + result = api_instance.update_reward_assignment1(campaign_id, assignment_id, opts) p result rescue VoucherifySdk::ApiError => e - puts "Error when calling LoyaltiesApi->update_loyalty_card_balance1: #{e}" + puts "Error when calling LoyaltiesApi->update_reward_assignment1: #{e}" end ``` @@ -1624,13 +2786,13 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign_id** | **String** | Unique campaign ID. | | -| **member_id** | **String** | A code that identifies the loyalty card. | | -| **loyalties_members_balance_update_request_body** | [**LoyaltiesMembersBalanceUpdateRequestBody**](LoyaltiesMembersBalanceUpdateRequestBody.md) | Specify the point adjustment along with the expiration mechanism. | [optional] | +| **campaign_id** | **String** | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignment_id** | **String** | A unique reward assignment ID. | | +| **loyalties_rewards_update_assignment_request_body** | [**LoyaltiesRewardsUpdateAssignmentRequestBody**](LoyaltiesRewardsUpdateAssignmentRequestBody.md) | Update the points cost for the reward assignment. | [optional] | ### Return type -[**LoyaltiesMembersBalanceUpdateResponseBody**](LoyaltiesMembersBalanceUpdateResponseBody.md) +[**LoyaltiesRewardsUpdateAssignmentResponseBody**](LoyaltiesRewardsUpdateAssignmentResponseBody.md) ### Authorization diff --git a/docs/LoyaltiesCreateCampaignRequestBody.md b/docs/LoyaltiesCreateCampaignRequestBody.md new file mode 100644 index 00000000..04084361 --- /dev/null +++ b/docs/LoyaltiesCreateCampaignRequestBody.md @@ -0,0 +1,26 @@ +# VoucherifySdk::LoyaltiesCreateCampaignRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Campaign name. | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign (size of campaign). | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | +| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | +| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | +| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LOYALTY_PROGRAM'] | +| **voucher** | [**CampaignLoyaltyVoucher**](CampaignLoyaltyVoucher.md) | | [optional] | + diff --git a/docs/LoyaltiesCreateCampaignResponseBody.md b/docs/LoyaltiesCreateCampaignResponseBody.md new file mode 100644 index 00000000..9f0d288f --- /dev/null +++ b/docs/LoyaltiesCreateCampaignResponseBody.md @@ -0,0 +1,37 @@ +# VoucherifySdk::LoyaltiesCreateCampaignResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LOYALTY_PROGRAM'] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | +| **voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | +| **category** | **String** | Unique category name. | [optional] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | +| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | + diff --git a/docs/LoyaltiesDeleteResponseBody.md b/docs/LoyaltiesDeleteResponseBody.md index 92e53353..153c8732 100644 --- a/docs/LoyaltiesDeleteResponseBody.md +++ b/docs/LoyaltiesDeleteResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItem.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItem.md new file mode 100644 index 00000000..ea3fc8d0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItem.md @@ -0,0 +1,21 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyalty**](LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **source** | [**LoyaltiesEarningRulesCreateRequestBodyItemSource**](LoyaltiesEarningRulesCreateRequestBodyItemSource.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] | +| **start_date** | **Time** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | +| **expiration_date** | **Time** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **segment** | [**LoyaltiesEarningRulesCreateRequestBodyItemSegment**](LoyaltiesEarningRulesCreateRequestBodyItemSegment.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent**](LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md) | | [optional] | +| **loyalty_tier** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md new file mode 100644 index 00000000..d9da222b --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Contains a unique identifier of a custom event schema. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md new file mode 100644 index 00000000..6f186836 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | +| **calculation_type** | **String** | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md) | | [optional] | +| **order** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md new file mode 100644 index 00000000..49ab276d --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..9ff2dbc6 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md new file mode 100644 index 00000000..4be884b2 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..b5e9d5b0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md new file mode 100644 index 00000000..dfcb32d1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md new file mode 100644 index 00000000..97e77dfb --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md new file mode 100644 index 00000000..06f89d31 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..38bcfc47 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..9680dcfb --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..75269724 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md new file mode 100644 index 00000000..d178f431 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..9de322b5 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md new file mode 100644 index 00000000..fe36048c --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md new file mode 100644 index 00000000..ef687db7 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemSegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md new file mode 100644 index 00000000..1449cdd3 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateRequestBodyItemSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBody.md b/docs/LoyaltiesEarningRulesCreateResponseBody.md new file mode 100644 index 00000000..598198c1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBody.md @@ -0,0 +1,26 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesCreateResponseBodyLoyalty**](LoyaltiesEarningRulesCreateResponseBodyLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesCreateResponseBodyCustomEvent**](LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md) | | [optional] | +| **segment** | [**LoyaltiesEarningRulesCreateResponseBodySegment**](LoyaltiesEarningRulesCreateResponseBodySegment.md) | | [optional] | +| **loyalty_tier** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md) | | [optional] | +| **source** | [**LoyaltiesEarningRulesCreateResponseBodySource**](LoyaltiesEarningRulesCreateResponseBodySource.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is earning_rule. | [optional][default to 'earning_rule'] | +| **automation_id** | **String** | For internal use by Voucherify. | [optional] | +| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] | +| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | +| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md new file mode 100644 index 00000000..6d1e7dd9 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Unique identifier of the custom event schema | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md new file mode 100644 index 00000000..4390ce29 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..b69004b3 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..d4029218 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..b60118e0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..ecec961c --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..d88c3770 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..97e95173 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..bc7752c9 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..76b38bbc --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..f4246594 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..aa27ad17 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..ec232158 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..c98c13f1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..e655b926 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodySegment.md b/docs/LoyaltiesEarningRulesCreateResponseBodySegment.md new file mode 100644 index 00000000..4f94cc2d --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodySegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodySegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesCreateResponseBodySource.md b/docs/LoyaltiesEarningRulesCreateResponseBodySource.md new file mode 100644 index 00000000..56680c59 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodySource.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesCreateResponseBodySource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | +| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | [optional] | +| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional][default to 'campaign'] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBody.md b/docs/LoyaltiesEarningRulesDisableResponseBody.md index f827b127..ba68fce1 100644 --- a/docs/LoyaltiesEarningRulesDisableResponseBody.md +++ b/docs/LoyaltiesEarningRulesDisableResponseBody.md @@ -4,20 +4,22 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | | -| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. | | -| **loyalty** | [**EarningRuleBaseLoyalty**](EarningRuleBaseLoyalty.md) | | | -| **event** | [**EarningRuleEvent**](EarningRuleEvent.md) | | [optional] | -| **custom_event** | [**EarningRuleBaseCustomEvent**](EarningRuleBaseCustomEvent.md) | | [optional] | -| **segment** | [**EarningRuleBaseSegment**](EarningRuleBaseSegment.md) | | [optional] | -| **source** | [**EarningRuleBaseSource**](EarningRuleBaseSource.md) | | | -| **object** | **String** | The type of object represented by JSON. Default is earning_rule. | [default to 'earning_rule'] | -| **automation_id** | **String** | For internal use by Voucherify. | | -| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | -| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | -| **validity_timeframe** | [**EarningRuleBaseValidityTimeframe**](EarningRuleBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | | -| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [default to false] | +| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesDisableResponseBodyLoyalty**](LoyaltiesEarningRulesDisableResponseBodyLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesDisableResponseBodyCustomEvent**](LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md) | | [optional] | +| **segment** | [**LoyaltiesEarningRulesDisableResponseBodySegment**](LoyaltiesEarningRulesDisableResponseBodySegment.md) | | [optional] | +| **loyalty_tier** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md) | | [optional] | +| **source** | [**LoyaltiesEarningRulesDisableResponseBodySource**](LoyaltiesEarningRulesDisableResponseBodySource.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is earning_rule. | [optional][default to 'earning_rule'] | +| **automation_id** | **String** | For internal use by Voucherify. | [optional] | +| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] | +| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [optional][default to false] | diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md new file mode 100644 index 00000000..826b8c13 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Unique identifier of the custom event schema | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md new file mode 100644 index 00000000..c6946cfc --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..d51e6913 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..76a40098 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..d4f88dd9 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..a2c67015 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..bac29b80 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..605208a7 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..94db3b4e --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..4876cac4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..91dc4ac2 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..e7e2a7b2 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..5166f34f --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..450baed6 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..a1d72428 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodySegment.md b/docs/LoyaltiesEarningRulesDisableResponseBodySegment.md new file mode 100644 index 00000000..b921718d --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodySegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodySegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesDisableResponseBodySource.md b/docs/LoyaltiesEarningRulesDisableResponseBodySource.md new file mode 100644 index 00000000..dcac8d1b --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodySource.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesDisableResponseBodySource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | +| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | [optional] | +| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional][default to 'campaign'] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBody.md b/docs/LoyaltiesEarningRulesEnableResponseBody.md index a14ce143..2dca1d8a 100644 --- a/docs/LoyaltiesEarningRulesEnableResponseBody.md +++ b/docs/LoyaltiesEarningRulesEnableResponseBody.md @@ -4,20 +4,22 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | | -| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. | | -| **loyalty** | [**EarningRuleBaseLoyalty**](EarningRuleBaseLoyalty.md) | | | -| **event** | [**EarningRuleEvent**](EarningRuleEvent.md) | | [optional] | -| **custom_event** | [**EarningRuleBaseCustomEvent**](EarningRuleBaseCustomEvent.md) | | [optional] | -| **segment** | [**EarningRuleBaseSegment**](EarningRuleBaseSegment.md) | | [optional] | -| **source** | [**EarningRuleBaseSource**](EarningRuleBaseSource.md) | | | -| **object** | **String** | The type of object represented by JSON. Default is earning_rule. | [default to 'earning_rule'] | -| **automation_id** | **String** | For internal use by Voucherify. | | -| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | -| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | -| **validity_timeframe** | [**EarningRuleBaseValidityTimeframe**](EarningRuleBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | | -| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [default to true] | +| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesEnableResponseBodyLoyalty**](LoyaltiesEarningRulesEnableResponseBodyLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesEnableResponseBodyCustomEvent**](LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md) | | [optional] | +| **segment** | [**LoyaltiesEarningRulesEnableResponseBodySegment**](LoyaltiesEarningRulesEnableResponseBodySegment.md) | | [optional] | +| **loyalty_tier** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md) | | [optional] | +| **source** | [**LoyaltiesEarningRulesEnableResponseBodySource**](LoyaltiesEarningRulesEnableResponseBodySource.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is earning_rule. | [optional][default to 'earning_rule'] | +| **automation_id** | **String** | For internal use by Voucherify. | [optional] | +| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] | +| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [optional][default to true] | diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md new file mode 100644 index 00000000..f6c16e13 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Unique identifier of the custom event schema | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md new file mode 100644 index 00000000..0a64fcf6 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..13c82c17 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..4bc75b92 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..872d166e --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..6156a9e1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..5b40b564 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..b3e699af --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..fb467337 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..39b89bba --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..f82eeb71 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..a1f47b64 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..cef2ee1d --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..6db66c92 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..05e7f9b2 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodySegment.md b/docs/LoyaltiesEarningRulesEnableResponseBodySegment.md new file mode 100644 index 00000000..e69872cb --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodySegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodySegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesEnableResponseBodySource.md b/docs/LoyaltiesEarningRulesEnableResponseBodySource.md new file mode 100644 index 00000000..b117ed3e --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodySource.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesEnableResponseBodySource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | +| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | [optional] | +| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional][default to 'campaign'] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBody.md b/docs/LoyaltiesEarningRulesGetResponseBody.md index 042cc4e7..94d4f9ea 100644 --- a/docs/LoyaltiesEarningRulesGetResponseBody.md +++ b/docs/LoyaltiesEarningRulesGetResponseBody.md @@ -4,21 +4,23 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | | -| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. | | -| **loyalty** | [**EarningRuleBaseLoyalty**](EarningRuleBaseLoyalty.md) | | | -| **event** | [**EarningRuleEvent**](EarningRuleEvent.md) | | [optional] | -| **custom_event** | [**EarningRuleBaseCustomEvent**](EarningRuleBaseCustomEvent.md) | | [optional] | -| **segment** | [**EarningRuleBaseSegment**](EarningRuleBaseSegment.md) | | [optional] | -| **source** | [**EarningRuleBaseSource**](EarningRuleBaseSource.md) | | | -| **object** | **String** | The type of object represented by JSON. Default is earning_rule. | [default to 'earning_rule'] | -| **automation_id** | **String** | For internal use by Voucherify. | | -| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | -| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | -| **validity_timeframe** | [**EarningRuleBaseValidityTimeframe**](EarningRuleBaseValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | | -| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | | -| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | | +| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesGetResponseBodyLoyalty**](LoyaltiesEarningRulesGetResponseBodyLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesGetResponseBodyCustomEvent**](LoyaltiesEarningRulesGetResponseBodyCustomEvent.md) | | [optional] | +| **segment** | [**LoyaltiesEarningRulesGetResponseBodySegment**](LoyaltiesEarningRulesGetResponseBodySegment.md) | | [optional] | +| **loyalty_tier** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyTier**](LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md) | | [optional] | +| **source** | [**LoyaltiesEarningRulesGetResponseBodySource**](LoyaltiesEarningRulesGetResponseBodySource.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is earning_rule. | [optional][default to 'earning_rule'] | +| **automation_id** | **String** | For internal use by Voucherify. | [optional] | +| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] | +| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | +| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] | diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md new file mode 100644 index 00000000..56b5c300 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Unique identifier of the custom event schema | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md new file mode 100644 index 00000000..1481ea17 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..f1e76b41 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..0445fb6b --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..b0fc7592 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..c25f6f1d --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..fc057414 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..aa573f56 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..6e469f60 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..29ddf1d8 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..085a508d --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..4264e147 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..aa0cf946 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..24572dfb --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..809af204 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodyLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodySegment.md b/docs/LoyaltiesEarningRulesGetResponseBodySegment.md new file mode 100644 index 00000000..c5c9287e --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodySegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodySegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesGetResponseBodySource.md b/docs/LoyaltiesEarningRulesGetResponseBodySource.md new file mode 100644 index 00000000..b3d23a16 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodySource.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesGetResponseBodySource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | +| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | [optional] | +| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional][default to 'campaign'] | + diff --git a/docs/LoyaltiesEarningRulesListResponseBody.md b/docs/LoyaltiesEarningRulesListResponseBody.md new file mode 100644 index 00000000..49ac5db0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesListResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about earning rules in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of earning rule objects. | [optional][default to 'data'] | +| **data** | [**Array<EarningRule>**](EarningRule.md) | Contains array of earning rule objects. | [optional] | +| **total** | **Integer** | Total number of earning rule objects. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBody.md b/docs/LoyaltiesEarningRulesUpdateRequestBody.md new file mode 100644 index 00000000..295d1e73 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBody.md @@ -0,0 +1,17 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyalty**](LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md) | | [optional] | +| **source** | [**LoyaltiesEarningRulesUpdateRequestBodySource**](LoyaltiesEarningRulesUpdateRequestBodySource.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] | +| **start_date** | **Time** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] | +| **expiration_date** | **Time** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md new file mode 100644 index 00000000..e9485d91 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..4bc554e6 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..2630e0c4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md new file mode 100644 index 00000000..f4ffa211 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..59370ecd --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md new file mode 100644 index 00000000..f47d09ef --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..10cac95a --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..32d7012d --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..c1d9c930 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..dfbe7678 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..03e74318 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..84cf2c1b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..5365761e --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateRequestBodySource.md b/docs/LoyaltiesEarningRulesUpdateRequestBodySource.md new file mode 100644 index 00000000..d60e7250 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodySource.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateRequestBodySource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBody.md b/docs/LoyaltiesEarningRulesUpdateResponseBody.md new file mode 100644 index 00000000..7354ae6b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBody.md @@ -0,0 +1,26 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **loyalty** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyalty**](LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md) | | [optional] | +| **event** | **String** | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesUpdateResponseBodyCustomEvent**](LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md) | | [optional] | +| **segment** | [**LoyaltiesEarningRulesUpdateResponseBodySegment**](LoyaltiesEarningRulesUpdateResponseBodySegment.md) | | [optional] | +| **loyalty_tier** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md) | | [optional] | +| **source** | [**LoyaltiesEarningRulesUpdateResponseBodySource**](LoyaltiesEarningRulesUpdateResponseBodySource.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is earning_rule. | [optional][default to 'earning_rule'] | +| **automation_id** | **String** | For internal use by Voucherify. | [optional] | +| **start_date** | **String** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] | +| **expiration_date** | **String** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] | +| **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] | +| **active** | **Boolean** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md new file mode 100644 index 00000000..cc340988 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **schema_id** | **String** | Unique identifier of the custom event schema | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md new file mode 100644 index 00000000..c6f2b127 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md @@ -0,0 +1,14 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **calculation_type** | **String** | | [optional] | +| **order** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md) | | [optional] | +| **order_items** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md) | | [optional] | +| **customer** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md) | | [optional] | +| **custom_event** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md) | | [optional] | +| **points** | **Integer** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..05043cda --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..44c4c4ef --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Custom event metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..378c2622 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metadata** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..a926a532 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the customer metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Customer metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..0295540b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md) | | [optional] | +| **total_amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] | +| **metadata** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..b20a747b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..12e59ec0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] | +| **amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] | +| **subtotal_amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..878d5927 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..7d5bdf4a --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..31b3d41d --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **object** | **String** | Type of object taken under consideration. | [optional] | +| **id** | **String** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..670db5fe --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | For how many increments of the order metadata property to grant points for. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | +| **property** | **String** | Order metadata property. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..22fd977e --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **every** | **Integer** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] | +| **points** | **Integer** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..5f17c5ce --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md b/docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md new file mode 100644 index 00000000..2b66fdf4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodySegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] | + diff --git a/docs/LoyaltiesEarningRulesUpdateResponseBodySource.md b/docs/LoyaltiesEarningRulesUpdateResponseBodySource.md new file mode 100644 index 00000000..9edf71ab --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodySource.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesEarningRulesUpdateResponseBodySource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | +| **object_id** | **String** | A unique campaign identifier assigned by the Voucherify API. | [optional] | +| **object_type** | **String** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional][default to 'campaign'] | + diff --git a/docs/LoyaltiesGetCampaignResponseBody.md b/docs/LoyaltiesGetCampaignResponseBody.md new file mode 100644 index 00000000..a246a9b2 --- /dev/null +++ b/docs/LoyaltiesGetCampaignResponseBody.md @@ -0,0 +1,37 @@ +# VoucherifySdk::LoyaltiesGetCampaignResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LOYALTY_PROGRAM'] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | +| **voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | +| **category** | **String** | Unique category name. | [optional] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | +| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | + diff --git a/docs/LoyaltiesListCampaignsResponseBody.md b/docs/LoyaltiesListCampaignsResponseBody.md new file mode 100644 index 00000000..033d1d93 --- /dev/null +++ b/docs/LoyaltiesListCampaignsResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesListCampaignsResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty campaigns in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty campaign objects. | [optional][default to 'campaigns'] | +| **campaigns** | [**Array<LoyaltyCampaign>**](LoyaltyCampaign.md) | Contains an array of loyalty campaign objects. | [optional] | +| **total** | **Integer** | Total number of loyalty campaign objects. | [optional] | + diff --git a/docs/LoyaltiesListMembersResponseBody.md b/docs/LoyaltiesListMembersResponseBody.md new file mode 100644 index 00000000..efa1bcef --- /dev/null +++ b/docs/LoyaltiesListMembersResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesListMembersResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about members in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of voucher objects. | [optional][default to 'vouchers'] | +| **vouchers** | [**Array<LoyaltyMember>**](LoyaltyMember.md) | Contains array of voucher objects representing loyalty cards, in other words, loyalty program members. | [optional] | +| **total** | **Integer** | Total number of voucher objects. | [optional] | + diff --git a/docs/LoyaltiesLoyaltyTierReward.md b/docs/LoyaltiesLoyaltyTierReward.md index 3a07a199..70284a14 100644 --- a/docs/LoyaltiesLoyaltyTierReward.md +++ b/docs/LoyaltiesLoyaltyTierReward.md @@ -6,5 +6,5 @@ | ---- | ---- | ----------- | ----- | | **reward** | [**Reward**](Reward.md) | | | | **assignment** | [**RewardAssignment**](RewardAssignment.md) | | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the loyalty tier reward. | [default to 'loyalty_tier_reward'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the loyalty tier reward. | [default to 'loyalty_tier_reward'] | diff --git a/docs/LoyaltiesMemberActivityListResponseBody.md b/docs/LoyaltiesMemberActivityListResponseBody.md new file mode 100644 index 00000000..65693d7a --- /dev/null +++ b/docs/LoyaltiesMemberActivityListResponseBody.md @@ -0,0 +1,12 @@ +# VoucherifySdk::LoyaltiesMemberActivityListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about member activities in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of member activity objects. | [optional][default to 'data'] | +| **data** | [**Array<MemberActivity>**](MemberActivity.md) | Array of member activity objects. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] | +| **more_starting_after** | **String** | Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. | [optional] | + diff --git a/docs/LoyaltiesMembersBalanceUpdateRequestBody.md b/docs/LoyaltiesMembersBalanceUpdateRequestBody.md index 56e7bed3..1ba65810 100644 --- a/docs/LoyaltiesMembersBalanceUpdateRequestBody.md +++ b/docs/LoyaltiesMembersBalanceUpdateRequestBody.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100 | | +| **points** | **Integer** | Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100 | [optional] | | **expiration_type** | [**PointsExpirationTypes**](PointsExpirationTypes.md) | | [optional] | | **expiration_date** | **Time** | Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`. | [optional] | | **reason** | **String** | Reason for the transfer. | [optional] | -| **source_id** | **String** | The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] | +| **source_id** | **String** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] | diff --git a/docs/LoyaltiesMembersBalanceUpdateResponseBody.md b/docs/LoyaltiesMembersBalanceUpdateResponseBody.md index 81833fa9..5b062014 100644 --- a/docs/LoyaltiesMembersBalanceUpdateResponseBody.md +++ b/docs/LoyaltiesMembersBalanceUpdateResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | The incremental points removed or added to the current balance on the loyalty card. | | -| **total** | **Integer** | The total of points accrued over the lifetime of the loyalty card. | | -| **balance** | **Integer** | The balance after adding/removing points. | | -| **type** | **String** | The type of voucher being modified. | | -| **object** | **String** | The type of object represented by JSON. Default is balance. | [default to 'balance'] | -| **related_object** | [**LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject**](LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) | | | +| **points** | **Integer** | The incremental points removed or added to the current balance on the loyalty card. | [optional] | +| **total** | **Integer** | The total of points accrued over the lifetime of the loyalty card. | [optional] | +| **balance** | **Integer** | The balance after adding/removing points. | [optional] | +| **type** | **String** | The type of voucher being modified. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is balance. | [optional][default to 'balance'] | +| **related_object** | [**LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject**](LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) | | [optional] | | **operation_type** | **String** | | [optional] | diff --git a/docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md b/docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md index 1889c089..193d5297 100644 --- a/docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md +++ b/docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | The object being modified. | [default to 'voucher'] | -| **id** | **String** | Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API. | | +| **type** | **String** | The object being modified. | [optional][default to 'voucher'] | +| **id** | **String** | Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] | diff --git a/docs/LoyaltiesMembersCreateRequestBody.md b/docs/LoyaltiesMembersCreateRequestBody.md new file mode 100644 index 00000000..bbea753a --- /dev/null +++ b/docs/LoyaltiesMembersCreateRequestBody.md @@ -0,0 +1,12 @@ +# VoucherifySdk::LoyaltiesMembersCreateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **voucher** | **String** | Code of voucher being published. | [optional] | +| **source_id** | **String** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] | +| **customer** | [**Customer**](Customer.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] | +| **channel** | **String** | Specify the distribution channel. | [optional] | + diff --git a/docs/LoyaltiesMembersCreateResponseBody.md b/docs/LoyaltiesMembersCreateResponseBody.md new file mode 100644 index 00000000..a4e18cac --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBody.md @@ -0,0 +1,33 @@ +# VoucherifySdk::LoyaltiesMembersCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional][default to 'LOYALTY_CARD'] | +| **discount** | **Object** | | [optional] | +| **gift** | **Object** | | [optional] | +| **loyalty_card** | [**LoyaltiesMembersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersCreateResponseBodyLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | This is always false for loyalty members. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique identifier of the customer who owns the voucher. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**LoyaltiesMembersCreateResponseBodyPublish**](LoyaltiesMembersCreateResponseBodyPublish.md) | | [optional] | +| **redemption** | [**LoyaltiesMembersCreateResponseBodyRedemption**](LoyaltiesMembersCreateResponseBodyRedemption.md) | | [optional] | + diff --git a/docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..011a1e75 --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesMembersCreateResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/LoyaltiesMembersCreateResponseBodyPublish.md b/docs/LoyaltiesMembersCreateResponseBodyPublish.md new file mode 100644 index 00000000..f5cde936 --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesMembersCreateResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication event counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/LoyaltiesMembersCreateResponseBodyRedemption.md b/docs/LoyaltiesMembersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..2e66db83 --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::LoyaltiesMembersCreateResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/LoyaltiesMembersGetResponseBody.md b/docs/LoyaltiesMembersGetResponseBody.md new file mode 100644 index 00000000..71ed0ad2 --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBody.md @@ -0,0 +1,33 @@ +# VoucherifySdk::LoyaltiesMembersGetResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional][default to 'LOYALTY_CARD'] | +| **discount** | **Object** | | [optional] | +| **gift** | **Object** | | [optional] | +| **loyalty_card** | [**LoyaltiesMembersGetResponseBodyLoyaltyCard**](LoyaltiesMembersGetResponseBodyLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | This is always false for loyalty members. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique identifier of the customer who owns the voucher. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**LoyaltiesMembersGetResponseBodyPublish**](LoyaltiesMembersGetResponseBodyPublish.md) | | [optional] | +| **redemption** | [**LoyaltiesMembersGetResponseBodyRedemption**](LoyaltiesMembersGetResponseBodyRedemption.md) | | [optional] | + diff --git a/docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..52b39ca6 --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesMembersGetResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/LoyaltiesMembersGetResponseBodyPublish.md b/docs/LoyaltiesMembersGetResponseBodyPublish.md new file mode 100644 index 00000000..9ea1b38a --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesMembersGetResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication event counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/LoyaltiesMembersGetResponseBodyRedemption.md b/docs/LoyaltiesMembersGetResponseBodyRedemption.md new file mode 100644 index 00000000..6f2e84b5 --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::LoyaltiesMembersGetResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/LoyaltiesMembersPointsExpirationListResponseBody.md b/docs/LoyaltiesMembersPointsExpirationListResponseBody.md index c381b803..b9555a5d 100644 --- a/docs/LoyaltiesMembersPointsExpirationListResponseBody.md +++ b/docs/LoyaltiesMembersPointsExpirationListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects. | [default to 'data'] | -| **data** | [**Array<LoyaltiesMembersPointsExpirationListResponseBodyDataItem>**](LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) | Contains array of loyalty points expiration buckets. | | -| **total** | **Integer** | Total number of point expiration buckets. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects. | [optional][default to 'data'] | +| **data** | [**Array<LoyaltiesMembersPointsExpirationListResponseBodyDataItem>**](LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) | Contains array of loyalty points expiration buckets. | [optional] | +| **total** | **Integer** | Total number of point expiration buckets. | [optional] | diff --git a/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md b/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md index 9abaa3f8..45a033bb 100644 --- a/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md +++ b/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md @@ -8,9 +8,9 @@ | **voucher_id** | **String** | Unique parent loyalty card ID. | | | **campaign_id** | **String** | Unique parent campaign ID. | | | **bucket** | [**LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket**](LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md) | | | -| **created_at** | **Time** | Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format. | | +| **created_at** | **Time** | Timestamp representing the date and time when the loyalty points bucket object was created. The value is shown in the ISO 8601 format. | | | **status** | **String** | Loyalty points bucket point status. | | | **expires_at** | **Time** | Date when the number of points defined in the bucket object are due to expire. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the loyalty points bucket. | [default to 'loyalty_points_bucket'] | +| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty points bucket object was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the loyalty points bucket. | [default to 'loyalty_points_bucket'] | diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBody.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBody.md index f203e65b..216c9f57 100644 --- a/docs/LoyaltiesMembersRedemptionRedeemResponseBody.md +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBody.md @@ -4,27 +4,27 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | | -| **object** | **String** | The type of object represented by the JSON | [default to 'redemption'] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the redeeming customer. | | -| **tracking_id** | **String** | Hashed customer source ID. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **redemption** | **String** | Unique redemption ID of the parent redemption. | | -| **result** | **String** | Redemption result. | | -| **status** | **String** | Redemption status. | | -| **related_redemptions** | [**RedemptionRelatedRedemptions**](RedemptionRelatedRedemptions.md) | | [optional] | +| **id** | **String** | Unique redemption ID. | [optional] | +| **object** | **String** | The type of the object represented by the JSON | [optional][default to 'redemption'] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] | +| **amount** | **Integer** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | Redemption status. | [optional] | +| **related_redemptions** | [**LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md) | | [optional] | | **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | | **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | -| **order** | [**OrderCalculatedNoCustomerData**](OrderCalculatedNoCustomerData.md) | | | -| **channel** | [**RedemptionChannel**](RedemptionChannel.md) | | | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | | -| **related_object_type** | **String** | Defines the related object. | | -| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | | -| **voucher** | [**Voucher**](Voucher.md) | | [optional] | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | +| **channel** | [**LoyaltiesMembersRedemptionRedeemResponseBodyChannel**](LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md) | | [optional] | +| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] | +| **voucher** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucher**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md) | | [optional] | | **promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] | -| **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | | -| **gift** | [**RedemptionGift**](RedemptionGift.md) | | [optional] | -| **loyalty_card** | [**RedemptionLoyaltyCard**](RedemptionLoyaltyCard.md) | | [optional] | +| **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | +| **gift** | [**LoyaltiesMembersRedemptionRedeemResponseBodyGift**](LoyaltiesMembersRedemptionRedeemResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard**](LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md) | | [optional] | diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md new file mode 100644 index 00000000..303935e7 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **channel_id** | **String** | 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. | [optional] | +| **channel_type** | **String** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md new file mode 100644 index 00000000..b2eb84aa --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..26cf2dbc --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points subtracted from the loyalty card as a result of the redemption. | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md new file mode 100644 index 00000000..63cfff80 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rollbacks** | [**Array<LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem>**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] | +| **redemptions** | [**Array<LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem>**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md) | | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..2a576c00 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..670f3b02 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique rollback redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md new file mode 100644 index 00000000..fc6a7c85 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md @@ -0,0 +1,37 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md) | | [optional] | +| **loyalty_card** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md) | | [optional] | +| **redemption** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md new file mode 100644 index 00000000..73569545 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md new file mode 100644 index 00000000..1c440eb3 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md new file mode 100644 index 00000000..12f45254 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md new file mode 100644 index 00000000..e15194a2 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/LoyaltiesMembersRewardsListResponseBody.md b/docs/LoyaltiesMembersRewardsListResponseBody.md index 8379eb28..15bae2c2 100644 --- a/docs/LoyaltiesMembersRewardsListResponseBody.md +++ b/docs/LoyaltiesMembersRewardsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty reward objects. | [default to 'data'] | -| **data** | [**Array<LoyaltiesMembersRewardsListResponseBodyDataItem>**](LoyaltiesMembersRewardsListResponseBodyDataItem.md) | Contains array of loyalty reward objects. | | -| **total** | **Integer** | Total number of loyalty reward objects. | | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty reward objects. | [optional][default to 'data'] | +| **data** | [**Array<LoyaltiesMembersRewardsListResponseBodyDataItem>**](LoyaltiesMembersRewardsListResponseBodyDataItem.md) | Contains array of loyalty reward objects. | [optional] | +| **total** | **Integer** | Total number of loyalty reward objects. | [optional] | diff --git a/docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md b/docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md index 5b3394e4..50c8d447 100644 --- a/docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md +++ b/docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md @@ -6,5 +6,5 @@ | ---- | ---- | ----------- | ----- | | **reward** | [**Reward**](Reward.md) | | [optional] | | **assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [optional][default to 'loyalty_reward'] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'loyalty_reward'] | diff --git a/docs/LoyaltiesMembersTiersListResponseBody.md b/docs/LoyaltiesMembersTiersListResponseBody.md index 8f1b6c49..cc433ac5 100644 --- a/docs/LoyaltiesMembersTiersListResponseBody.md +++ b/docs/LoyaltiesMembersTiersListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [default to 'data'] | -| **data** | [**Array<LoyaltyTier>**](LoyaltyTier.md) | | | -| **total** | **Integer** | Total number of loyalty tier objects. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [optional][default to 'data'] | +| **data** | [**Array<LoyaltyTier>**](LoyaltyTier.md) | | [optional] | +| **total** | **Integer** | Total number of loyalty tier objects. | [optional] | diff --git a/docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md b/docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md index 1498ab4f..23275622 100644 --- a/docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md +++ b/docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the export. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional][default to 'SCHEDULED'] | | **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'voucher_transactions'] | -| **parameters** | [**LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) | | [optional] | +| **result** | **Object** | Contains the URL of the CSV file. | [optional] | +| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] | +| **exported_object** | **String** | The type of object to be exported. | [optional][default to 'voucher_transactions'] | +| **parameters** | [**LoyaltiesMembersTransactionsExportCreateResponseBodyParameters**](LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md) | | [optional] | diff --git a/docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md b/docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md new file mode 100644 index 00000000..f748f58a --- /dev/null +++ b/docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesMembersTransactionsExportCreateResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | [**ExportVoucherTransactionsOrder**](ExportVoucherTransactionsOrder.md) | | [optional] | +| **fields** | [**Array<ExportVoucherTransactionsFields>**](ExportVoucherTransactionsFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | +| **filters** | [**ExportVoucherTransactionsFilters**](ExportVoucherTransactionsFilters.md) | | [optional] | + diff --git a/docs/LoyaltiesMembersTransactionsListResponseBody.md b/docs/LoyaltiesMembersTransactionsListResponseBody.md index 00f39b6c..de872a3b 100644 --- a/docs/LoyaltiesMembersTransactionsListResponseBody.md +++ b/docs/LoyaltiesMembersTransactionsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of transaction objects. | [default to 'data'] | -| **data** | [**Array<LoyaltyCardTransaction>**](LoyaltyCardTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | | -| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. | | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of transaction objects. | [optional][default to 'data'] | +| **data** | [**Array<LoyaltyCardTransaction>**](LoyaltyCardTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the has_more flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | diff --git a/docs/LoyaltiesMembersTransfersCreateResponseBody.md b/docs/LoyaltiesMembersTransfersCreateResponseBody.md index 0b9b9923..5db7016a 100644 --- a/docs/LoyaltiesMembersTransfersCreateResponseBody.md +++ b/docs/LoyaltiesMembersTransfersCreateResponseBody.md @@ -4,27 +4,28 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | | -| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | | **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | | **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | -| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | | -| **category_id** | **String** | Unique category ID assigned by Voucherify. | | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | | **categories** | [**Array<Category>**](Category.md) | | [optional] | -| **type** | **String** | Defines the type of the voucher. | [default to 'LOYALTY_CARD'] | -| **loyalty_card** | [**LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) | | | -| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date. | | -| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date. | | -| **validity_timeframe** | [**LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe**](LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe.md) | | | +| **type** | **String** | Defines the type of the voucher. | [optional][default to 'LOYALTY_CARD'] | +| **loyalty_card** | [**LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | | | **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **publish** | [**LoyaltiesMembersTransfersCreateResponseBodyPublish**](LoyaltiesMembersTransfersCreateResponseBodyPublish.md) | | [optional] | | **redemption** | [**LoyaltiesMembersTransfersCreateResponseBodyRedemption**](LoyaltiesMembersTransfersCreateResponseBodyRedemption.md) | | [optional] | -| **active** | **String** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date. - `true` indicates an active voucher - `false` indicates an inactive voucher | | -| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | | +| **active** | **String** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date. - `true` indicates an active voucher - `false` indicates an inactive voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | | **assets** | [**LoyaltiesMembersTransfersCreateResponseBodyAssets**](LoyaltiesMembersTransfersCreateResponseBodyAssets.md) | | [optional] | -| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **created_at** | **Time** | | | +| **created_at** | **Time** | | [optional] | diff --git a/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md index 087effaf..005e4ccc 100644 --- a/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Total points incurred over lifespan of loyalty card. | | -| **balance** | **Integer** | Points available for reward redemption. | | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | | **next_expiration_date** | **String** | The next closest date when the next set of points are due to expire. | [optional] | | **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | diff --git a/docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md index 3f95b2fa..f71b582e 100644 --- a/docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [default to 'list'] | +| **object** | **String** | The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | | **count** | **Integer** | Publication events counter. | [optional] | | **entries** | **Array<String>** | | [optional] | | **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications | [optional] | diff --git a/docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md index 2ce5731a..cc42dd20 100644 --- a/docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md @@ -4,10 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **quantity** | **Integer** | How many times a voucher can be redeemed. A null value means unlimited. | | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A null value means unlimited. | [optional] | | **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | | **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | -| **redemption_entries** | **Array<String>** | | [optional] | -| **object** | **String** | The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **object** | **String** | The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | | **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions | [optional] | diff --git a/docs/LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe.md deleted file mode 100644 index 76013cc4..00000000 --- a/docs/LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **interval** | **String** | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour. | [optional] | -| **duration** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day. | [optional] | - diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBody.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBody.md new file mode 100644 index 00000000..ac405b3a --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBody.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **parameters** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParameters**](LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md new file mode 100644 index 00000000..a29e1f6e --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | **String** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | | [optional] | +| **filters** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md new file mode 100644 index 00000000..b1b19d83 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | [optional] | +| **voucher_id** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md) | | [optional] | +| **campaign_id** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md new file mode 100644 index 00000000..bf8e68db --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md new file mode 100644 index 00000000..fc62094a --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **not_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **is** | **String** | Specify the exact resource value. | [optional] | +| **is_not** | **String** | Results should omit this value. | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md new file mode 100644 index 00000000..38639ac1 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md new file mode 100644 index 00000000..d2c22450 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **not_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **is** | **String** | Specify the exact resource value. | [optional] | +| **is_not** | **String** | Results should omit this value. | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBody.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBody.md new file mode 100644 index 00000000..b850a1c4 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBody.md @@ -0,0 +1,16 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the export. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed. | [optional][default to 'SCHEDULED'] | +| **channel** | **String** | The channel through which the export was triggered. | [optional] | +| **exported_object** | **String** | The type of exported object. | [optional][default to 'points_expiration'] | +| **parameters** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParameters**](LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md) | | [optional] | +| **result** | **Object** | Always null. | [optional] | +| **user_id** | **String** | `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard. `user_id` is returned when the channel value is `WEBSITE`. | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md new file mode 100644 index 00000000..ff9a8cbc --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | **String** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | | [optional] | +| **filters** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md new file mode 100644 index 00000000..d96875fb --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | [optional] | +| **voucher_id** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md) | | [optional] | +| **campaign_id** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md new file mode 100644 index 00000000..daa62d4f --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md new file mode 100644 index 00000000..31b631d4 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **not_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **is** | **String** | Specify the exact resource value. | [optional] | +| **is_not** | **String** | Results should omit this value. | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md new file mode 100644 index 00000000..76d31c51 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md) | | [optional] | + diff --git a/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md new file mode 100644 index 00000000..b3ac7e5d --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of the resource values that should be included in the results. | [optional] | +| **not_in** | **Array<String>** | Array of the resource values that should be excluded from the results. | [optional] | +| **is** | **String** | Specify the exact resource value. | [optional] | +| **is_not** | **String** | Results should omit this value. | [optional] | + diff --git a/docs/LoyaltiesRewardAssignmentsGetResponseBody.md b/docs/LoyaltiesRewardAssignmentsGetResponseBody.md index 18780e1e..611c7db9 100644 --- a/docs/LoyaltiesRewardAssignmentsGetResponseBody.md +++ b/docs/LoyaltiesRewardAssignmentsGetResponseBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**LoyaltiesRewardAssignmentsGetResponseBodyParameters**](LoyaltiesRewardAssignmentsGetResponseBodyParameters.md) | | [optional] | diff --git a/docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md new file mode 100644 index 00000000..387a59f3 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty**](LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..2e043619 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/LoyaltiesRewardAssignmentsListResponseBody.md b/docs/LoyaltiesRewardAssignmentsListResponseBody.md new file mode 100644 index 00000000..daf59db7 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsListResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesRewardAssignmentsListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of reward assignment objects. | [optional][default to 'data'] | +| **data** | [**Array<RewardAssignment>**](RewardAssignment.md) | Contains array of reward assignment objects. | [optional] | +| **total** | **Integer** | Total number of reward assignment objects. | [optional] | + diff --git a/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md index b1bafd5d..970c708f 100644 --- a/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md +++ b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward ID, assigned by Voucherify. | | -| **name** | **String** | Reward name. | | -| **stock** | **Integer** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | | -| **redeemed** | **Integer** | Defines the number of already invoked (successful) reward redemptions. | | -| **attributes** | [**RewardAttributes**](RewardAttributes.md) | | [optional] | -| **metadata** | **Object** | 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. | | -| **type** | **String** | Reward type. | | +| **id** | **String** | Unique reward ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Reward name. | [optional] | +| **stock** | **Integer** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] | +| **redeemed** | **Integer** | Defines the number of already invoked (successful) reward redemptions. | [optional] | +| **attributes** | [**LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes**](LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md) | | [optional] | +| **metadata** | **Object** | 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. | [optional] | +| **type** | **String** | Reward type. | [optional] | | **parameters** | [**RewardType**](RewardType.md) | | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the reward was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward. | [default to 'reward'] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] | diff --git a/docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md new file mode 100644 index 00000000..18088a63 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file. | [optional] | +| **description** | **String** | An arbitrary string that you can attach to a material reward. | [optional] | + diff --git a/docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md new file mode 100644 index 00000000..bea6d73b --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reward** | **String** | The ID of the reward that will be assigned to the campaign. | [optional] | +| **parameters** | [**LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters**](LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md) | | [optional] | +| **validation_rules** | **Array<String>** | | [optional] | + diff --git a/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md new file mode 100644 index 00000000..b9e5394d --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty**](LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..1b248c13 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. | [optional] | + diff --git a/docs/LoyaltiesRewardsCreateAssignmentResponseBody.md b/docs/LoyaltiesRewardsCreateAssignmentResponseBody.md new file mode 100644 index 00000000..bf8f59ef --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentResponseBody.md @@ -0,0 +1,15 @@ +# VoucherifySdk::LoyaltiesRewardsCreateAssignmentResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**LoyaltiesRewardsCreateAssignmentResponseBodyParameters**](LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md new file mode 100644 index 00000000..29afb046 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsCreateAssignmentResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty**](LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..14aad035 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/LoyaltiesRewardsGetResponseBody.md b/docs/LoyaltiesRewardsGetResponseBody.md index a58a0633..bc154d72 100644 --- a/docs/LoyaltiesRewardsGetResponseBody.md +++ b/docs/LoyaltiesRewardsGetResponseBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**LoyaltiesRewardsGetResponseBodyParameters**](LoyaltiesRewardsGetResponseBodyParameters.md) | | [optional] | diff --git a/docs/LoyaltiesRewardsGetResponseBodyParameters.md b/docs/LoyaltiesRewardsGetResponseBodyParameters.md new file mode 100644 index 00000000..49285d59 --- /dev/null +++ b/docs/LoyaltiesRewardsGetResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsGetResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**LoyaltiesRewardsGetResponseBodyParametersLoyalty**](LoyaltiesRewardsGetResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..47a780a6 --- /dev/null +++ b/docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsGetResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/LoyaltiesRewardsListAssignmentsResponseBody.md b/docs/LoyaltiesRewardsListAssignmentsResponseBody.md new file mode 100644 index 00000000..8984f1db --- /dev/null +++ b/docs/LoyaltiesRewardsListAssignmentsResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltiesRewardsListAssignmentsResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of reward assignment objects. | [optional][default to 'data'] | +| **data** | [**Array<RewardAssignment>**](RewardAssignment.md) | Contains array of reward assignment objects. | [optional] | +| **total** | **Integer** | Total number of reward assignment objects. | [optional] | + diff --git a/docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md b/docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md new file mode 100644 index 00000000..086df489 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **parameters** | [**LoyaltiesRewardsUpdateAssignmentRequestBodyParameters**](LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md new file mode 100644 index 00000000..4df7d621 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty**](LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..04f17d56 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Defines how many points are required to obtain the reward. | [optional] | + diff --git a/docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md b/docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md new file mode 100644 index 00000000..f2708dfd --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md @@ -0,0 +1,15 @@ +# VoucherifySdk::LoyaltiesRewardsUpdateAssignmentResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**LoyaltiesRewardsUpdateAssignmentResponseBodyParameters**](LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md new file mode 100644 index 00000000..7f9529d5 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsUpdateAssignmentResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty**](LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..f788ebc5 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md b/docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md index 0fb299d0..5580c9f9 100644 --- a/docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md +++ b/docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Loyalty Tier name. | | +| **name** | **String** | Loyalty Tier name. | [optional] | | **earning_rules** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] | | **rewards** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] | -| **points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | | +| **points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] | diff --git a/docs/LoyaltiesTiersEarningRulesListResponseBody.md b/docs/LoyaltiesTiersEarningRulesListResponseBody.md index b8056f83..64c84d10 100644 --- a/docs/LoyaltiesTiersEarningRulesListResponseBody.md +++ b/docs/LoyaltiesTiersEarningRulesListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about earning rules in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of earning rule objects. | [default to 'data'] | -| **data** | [**Array<EarningRule>**](EarningRule.md) | Contains array of earning rule objects. | | -| **total** | **Integer** | Total number of earning rule objects. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about earning rules in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of earning rule objects. | [optional][default to 'data'] | +| **data** | [**Array<EarningRule>**](EarningRule.md) | Contains array of earning rule objects. | [optional] | +| **total** | **Integer** | Total number of earning rule objects. | [optional] | diff --git a/docs/LoyaltiesTiersGetResponseBody.md b/docs/LoyaltiesTiersGetResponseBody.md index 94dc82c6..877952f0 100644 --- a/docs/LoyaltiesTiersGetResponseBody.md +++ b/docs/LoyaltiesTiersGetResponseBody.md @@ -4,16 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Loyalty Tier name. | | +| **name** | **String** | Loyalty Tier name. | [optional] | | **earning_rules** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] | | **rewards** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] | -| **points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | | -| **id** | **String** | Unique loyalty tier ID. | | -| **campaign_id** | **String** | Unique parent campaign ID. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format. | [optional] | -| **config** | [**LoyaltyTierAllOfConfig**](LoyaltyTierAllOfConfig.md) | | | +| **points** | [**LoyaltiesTiersGetResponseBodyPoints**](LoyaltiesTiersGetResponseBodyPoints.md) | | [optional] | +| **id** | **String** | Unique loyalty tier ID. | [optional] | +| **campaign_id** | **String** | Unique parent campaign ID. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **config** | [**LoyaltiesTiersGetResponseBodyConfig**](LoyaltiesTiersGetResponseBodyConfig.md) | | [optional] | | **expiration** | [**LoyaltyTierExpiration**](LoyaltyTierExpiration.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the loyalty. | [default to 'loyalty_tier'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the loyalty. | [optional][default to 'loyalty_tier'] | diff --git a/docs/LoyaltiesTiersGetResponseBodyConfig.md b/docs/LoyaltiesTiersGetResponseBodyConfig.md new file mode 100644 index 00000000..b64a4e3b --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBodyConfig.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesTiersGetResponseBodyConfig + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | [**LoyaltiesTiersGetResponseBodyConfigPoints**](LoyaltiesTiersGetResponseBodyConfigPoints.md) | | [optional] | + diff --git a/docs/LoyaltiesTiersGetResponseBodyConfigPoints.md b/docs/LoyaltiesTiersGetResponseBodyConfigPoints.md new file mode 100644 index 00000000..0ebf13c7 --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBodyConfigPoints.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesTiersGetResponseBodyConfigPoints + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **Integer** | Bottom points threshold value. | [optional] | +| **to** | **Integer** | Top points threshold value. | [optional] | + diff --git a/docs/LoyaltiesTiersGetResponseBodyPoints.md b/docs/LoyaltiesTiersGetResponseBodyPoints.md new file mode 100644 index 00000000..212ba9d1 --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBodyPoints.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltiesTiersGetResponseBodyPoints + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **Integer** | Bottom points threshold value. | [optional] | +| **to** | **Integer** | Top points threshold value. | [optional] | + diff --git a/docs/LoyaltiesTiersListResponseBody.md b/docs/LoyaltiesTiersListResponseBody.md index 7e9bc237..726b6d18 100644 --- a/docs/LoyaltiesTiersListResponseBody.md +++ b/docs/LoyaltiesTiersListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [default to 'data'] | -| **data** | [**Array<LoyaltyTier>**](LoyaltyTier.md) | This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers. | | -| **total** | **Integer** | Total number of loyalty tier objects. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [optional][default to 'data'] | +| **data** | [**Array<LoyaltyTier>**](LoyaltyTier.md) | This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer's tiers. | [optional] | +| **total** | **Integer** | Total number of loyalty tier objects. | [optional] | diff --git a/docs/LoyaltiesTiersRewardsListResponseBody.md b/docs/LoyaltiesTiersRewardsListResponseBody.md index 73533312..03343639 100644 --- a/docs/LoyaltiesTiersRewardsListResponseBody.md +++ b/docs/LoyaltiesTiersRewardsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty tier reward objects. | [default to 'data'] | -| **data** | [**Array<LoyaltiesLoyaltyTierReward>**](LoyaltiesLoyaltyTierReward.md) | Contains array of loyalty tier reward objects. | | -| **total** | **Integer** | Total number of loyalty tier reward objects. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of loyalty tier reward objects. | [optional][default to 'data'] | +| **data** | [**Array<LoyaltiesLoyaltyTierReward>**](LoyaltiesLoyaltyTierReward.md) | Contains array of loyalty tier reward objects. | [optional] | +| **total** | **Integer** | Total number of loyalty tier reward objects. | [optional] | diff --git a/docs/LoyaltiesTransferPoints.md b/docs/LoyaltiesTransferPoints.md index 1562fe74..71117762 100644 --- a/docs/LoyaltiesTransferPoints.md +++ b/docs/LoyaltiesTransferPoints.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **String** | Unique loyalty card code from which the user wants to transfer loyalty points (source). | | -| **points** | **Integer** | The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source). | | +| **code** | **String** | Unique loyalty card code from which the user wants to transfer loyalty points (source). | [optional] | +| **points** | **Integer** | The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source). | [optional] | | **reason** | **String** | Reason for the transfer. | [optional] | -| **source_id** | **String** | The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | | +| **source_id** | **String** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] | diff --git a/docs/LoyaltiesUpdateCampaignRequestBody.md b/docs/LoyaltiesUpdateCampaignRequestBody.md new file mode 100644 index 00000000..f2411a8c --- /dev/null +++ b/docs/LoyaltiesUpdateCampaignRequestBody.md @@ -0,0 +1,23 @@ +# VoucherifySdk::LoyaltiesUpdateCampaignRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **category** | **String** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | +| **unset_metadata_fields** | **Array<String>** | Determine which metadata should be removed from campaign. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | +| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | +| **options** | [**LoyaltiesUpdateCampaignRequestBodyOptions**](LoyaltiesUpdateCampaignRequestBodyOptions.md) | | [optional] | + diff --git a/docs/LoyaltiesUpdateCampaignRequestBodyOptions.md b/docs/LoyaltiesUpdateCampaignRequestBodyOptions.md new file mode 100644 index 00000000..0cadad94 --- /dev/null +++ b/docs/LoyaltiesUpdateCampaignRequestBodyOptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltiesUpdateCampaignRequestBodyOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **recalculate_tiers** | **Boolean** | Determine if tiers should be recalculated or no. | [optional] | + diff --git a/docs/LoyaltiesUpdateCampaignResponseBody.md b/docs/LoyaltiesUpdateCampaignResponseBody.md new file mode 100644 index 00000000..56ef50ac --- /dev/null +++ b/docs/LoyaltiesUpdateCampaignResponseBody.md @@ -0,0 +1,37 @@ +# VoucherifySdk::LoyaltiesUpdateCampaignResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LOYALTY_PROGRAM'] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | +| **voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | +| **category** | **String** | Unique category name. | [optional] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | +| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | + diff --git a/docs/LoyaltyCampaign.md b/docs/LoyaltyCampaign.md new file mode 100644 index 00000000..bcda8a08 --- /dev/null +++ b/docs/LoyaltyCampaign.md @@ -0,0 +1,37 @@ +# VoucherifySdk::LoyaltyCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Campaign name. | [optional] | +| **description** | **String** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] | +| **campaign_type** | **String** | Type of campaign. | [optional][default to 'LOYALTY_PROGRAM'] | +| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] | +| **voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] | +| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | +| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | +| **use_voucher_metadata_schema** | **Boolean** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **activity_duration_after_publishing** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] | +| **vouchers_count** | **Integer** | Total number of unique vouchers in campaign. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **active** | **Boolean** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] | +| **category** | **String** | Unique category name. | [optional] | +| **creation_status** | **String** | Indicates the status of the campaign creation. | [optional] | +| **vouchers_generation_status** | **String** | Indicates the status of the campaign's voucher generation. | [optional] | +| **protected** | **Boolean** | Indicates whether the resource can be deleted. | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | +| **loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] | + diff --git a/docs/LoyaltyCampaignVoucher.md b/docs/LoyaltyCampaignVoucher.md new file mode 100644 index 00000000..cf786d8b --- /dev/null +++ b/docs/LoyaltyCampaignVoucher.md @@ -0,0 +1,17 @@ +# VoucherifySdk::LoyaltyCampaignVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of voucher. | [optional][default to 'LOYALTY_CARD'] | +| **loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] | +| **redemption** | [**LoyaltyCampaignVoucherRedemption**](LoyaltyCampaignVoucherRedemption.md) | | [optional] | +| **code_config** | [**CodeConfig**](CodeConfig.md) | | | +| **is_referral_code** | **Boolean** | Always `false` for a loyalty card voucher | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | + diff --git a/docs/LoyaltyCampaignVoucherRedemption.md b/docs/LoyaltyCampaignVoucherRedemption.md new file mode 100644 index 00000000..2624db6a --- /dev/null +++ b/docs/LoyaltyCampaignVoucherRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltyCampaignVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | + diff --git a/docs/LoyaltyCardTransaction.md b/docs/LoyaltyCardTransaction.md index dc8dcab8..551c748a 100644 --- a/docs/LoyaltyCardTransaction.md +++ b/docs/LoyaltyCardTransaction.md @@ -4,14 +4,14 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique transaction ID. | | -| **source_id** | **String** | The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | | -| **voucher_id** | **String** | Unique voucher ID. | | -| **campaign_id** | **String** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | | -| **source** | **String** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | | -| **reason** | **String** | Reason why the transaction occurred. In case of a redemption, this value is null. | | +| **id** | **String** | Unique transaction ID. | [optional] | +| **source_id** | **String** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | [optional] | +| **voucher_id** | **String** | Unique voucher ID. | [optional] | +| **campaign_id** | **String** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | [optional] | +| **source** | **String** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | [optional] | +| **reason** | **String** | Reason why the transaction occurred. In case of a redemption, this value is null. | [optional] | | **type** | [**LoyaltyCardTransactionsType**](LoyaltyCardTransactionsType.md) | | | -| **details** | [**VoucherTransactionDetails**](VoucherTransactionDetails.md) | | | -| **related_transaction_id** | **String** | The related transaction ID on the receiving card. | | -| **created_at** | **Time** | Timestamp representing the date and time when the transaction was created in ISO 8601 format. | | +| **details** | [**LoyaltyCardTransactionDetails**](LoyaltyCardTransactionDetails.md) | | [optional] | +| **related_transaction_id** | **String** | The related transaction ID on the receiving card. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/LoyaltyCardTransactionDetails.md b/docs/LoyaltyCardTransactionDetails.md new file mode 100644 index 00000000..4e51ab5e --- /dev/null +++ b/docs/LoyaltyCardTransactionDetails.md @@ -0,0 +1,20 @@ +# VoucherifySdk::LoyaltyCardTransactionDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **balance** | [**LoyaltyCardTransactionDetailsBalance**](LoyaltyCardTransactionDetailsBalance.md) | | [optional] | +| **order** | [**LoyaltyCardTransactionDetailsOrder**](LoyaltyCardTransactionDetailsOrder.md) | | [optional] | +| **event** | [**LoyaltyCardTransactionDetailsEvent**](LoyaltyCardTransactionDetailsEvent.md) | | [optional] | +| **earning_rule** | [**LoyaltyCardTransactionDetailsEarningRule**](LoyaltyCardTransactionDetailsEarningRule.md) | | [optional] | +| **segment** | [**LoyaltyCardTransactionDetailsSegment**](LoyaltyCardTransactionDetailsSegment.md) | | [optional] | +| **loyalty_tier** | [**LoyaltyCardTransactionDetailsLoyaltyTier**](LoyaltyCardTransactionDetailsLoyaltyTier.md) | | [optional] | +| **redemption** | [**LoyaltyCardTransactionDetailsRedemption**](LoyaltyCardTransactionDetailsRedemption.md) | | [optional] | +| **rollback** | [**LoyaltyCardTransactionDetailsRollback**](LoyaltyCardTransactionDetailsRollback.md) | | [optional] | +| **custom_event** | [**LoyaltyCardTransactionDetailsCustomEvent**](LoyaltyCardTransactionDetailsCustomEvent.md) | | [optional] | +| **event_schema** | [**LoyaltyCardTransactionDetailsEventSchema**](LoyaltyCardTransactionDetailsEventSchema.md) | | [optional] | +| **reward** | [**LoyaltyCardTransactionDetailsReward**](LoyaltyCardTransactionDetailsReward.md) | | [optional] | +| **source_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | +| **destination_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsBalance.md b/docs/LoyaltyCardTransactionDetailsBalance.md new file mode 100644 index 00000000..128b8580 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsBalance.md @@ -0,0 +1,13 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsBalance + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | The type of voucher whose balance is being adjusted due to the transaction. | [optional][default to 'loyalty_card'] | +| **total** | **Integer** | The number of all points accumulated on the card as affected by add or subtract operations. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. | [optional][default to 'balance'] | +| **points** | **Integer** | Points added or subtracted in the transaction. | [optional] | +| **balance** | **Integer** | The available points on the card after the transaction as affected by redemption or rollback. | [optional] | +| **related_object** | [**LoyaltyCardTransactionDetailsBalanceRelatedObject**](LoyaltyCardTransactionDetailsBalanceRelatedObject.md) | | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md b/docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md new file mode 100644 index 00000000..ca19bd66 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsBalanceRelatedObject + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] | +| **type** | **String** | The object being modified, i.e. voucher. | [optional][default to 'voucher'] | + diff --git a/docs/LoyaltyCardTransactionDetailsCustomEvent.md b/docs/LoyaltyCardTransactionDetailsCustomEvent.md new file mode 100644 index 00000000..cb35d12d --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsCustomEvent.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsCustomEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique event ID. | [optional] | +| **type** | **String** | Type of custom event. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsEarningRule.md b/docs/LoyaltyCardTransactionDetailsEarningRule.md new file mode 100644 index 00000000..218d8847 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEarningRule.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsEarningRule + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique earning rule ID. | [optional] | +| **source** | [**LoyaltyCardTransactionDetailsEarningRuleSource**](LoyaltyCardTransactionDetailsEarningRuleSource.md) | | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsEarningRuleSource.md b/docs/LoyaltyCardTransactionDetailsEarningRuleSource.md new file mode 100644 index 00000000..e142165b --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEarningRuleSource.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsEarningRuleSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsEvent.md b/docs/LoyaltyCardTransactionDetailsEvent.md new file mode 100644 index 00000000..ac74ffc6 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEvent.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique event ID. | [optional] | +| **type** | **String** | Type of event. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsEventSchema.md b/docs/LoyaltyCardTransactionDetailsEventSchema.md new file mode 100644 index 00000000..4f890998 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEventSchema.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsEventSchema + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique metadata schema ID. | [optional] | +| **name** | **String** | Type of custom event. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsLoyaltyTier.md b/docs/LoyaltyCardTransactionDetailsLoyaltyTier.md new file mode 100644 index 00000000..53b08a61 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsLoyaltyTier.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsLoyaltyTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **name** | **String** | | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsOrder.md b/docs/LoyaltyCardTransactionDetailsOrder.md new file mode 100644 index 00000000..f90f33ce --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsOrder.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique order ID. | [optional] | +| **source_id** | **String** | The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsRedemption.md b/docs/LoyaltyCardTransactionDetailsRedemption.md new file mode 100644 index 00000000..51e5d350 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsReward.md b/docs/LoyaltyCardTransactionDetailsReward.md new file mode 100644 index 00000000..e320d960 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsReward.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsReward + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID. | [optional] | +| **name** | **String** | Reward name. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsRollback.md b/docs/LoyaltyCardTransactionDetailsRollback.md new file mode 100644 index 00000000..fe65e437 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsRollback.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsRollback + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption rollback ID. | [optional] | + diff --git a/docs/LoyaltyCardTransactionDetailsSegment.md b/docs/LoyaltyCardTransactionDetailsSegment.md new file mode 100644 index 00000000..a386f26a --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsSegment.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyCardTransactionDetailsSegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **name** | **String** | | [optional] | + diff --git a/docs/LoyaltyMember.md b/docs/LoyaltyMember.md new file mode 100644 index 00000000..c930026e --- /dev/null +++ b/docs/LoyaltyMember.md @@ -0,0 +1,33 @@ +# VoucherifySdk::LoyaltyMember + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional][default to 'LOYALTY_CARD'] | +| **discount** | **Object** | | [optional] | +| **gift** | **Object** | | [optional] | +| **loyalty_card** | [**LoyaltyMemberLoyaltyCard**](LoyaltyMemberLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | This is always false for loyalty members. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique identifier of the customer who owns the voucher. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**LoyaltyMemberPublish**](LoyaltyMemberPublish.md) | | [optional] | +| **redemption** | [**LoyaltyMemberRedemption**](LoyaltyMemberRedemption.md) | | [optional] | + diff --git a/docs/LoyaltyMemberLoyaltyCard.md b/docs/LoyaltyMemberLoyaltyCard.md new file mode 100644 index 00000000..e1d88b95 --- /dev/null +++ b/docs/LoyaltyMemberLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::LoyaltyMemberLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/LoyaltyMemberPublish.md b/docs/LoyaltyMemberPublish.md new file mode 100644 index 00000000..4cc43718 --- /dev/null +++ b/docs/LoyaltyMemberPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::LoyaltyMemberPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication event counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/LoyaltyMemberRedemption.md b/docs/LoyaltyMemberRedemption.md new file mode 100644 index 00000000..226f5e27 --- /dev/null +++ b/docs/LoyaltyMemberRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::LoyaltyMemberRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/LoyaltyTier.md b/docs/LoyaltyTier.md index b10af6ec..56bc39a2 100644 --- a/docs/LoyaltyTier.md +++ b/docs/LoyaltyTier.md @@ -4,16 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Loyalty Tier name. | | +| **name** | **String** | Loyalty Tier name. | [optional] | | **earning_rules** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] | | **rewards** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] | -| **points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | | -| **id** | **String** | Unique loyalty tier ID. | | -| **campaign_id** | **String** | Unique parent campaign ID. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format. | [optional] | -| **config** | [**LoyaltyTierAllOfConfig**](LoyaltyTierAllOfConfig.md) | | | +| **points** | [**LoyaltyTierPoints**](LoyaltyTierPoints.md) | | [optional] | +| **id** | **String** | Unique loyalty tier ID. | [optional] | +| **campaign_id** | **String** | Unique parent campaign ID. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **config** | [**LoyaltyTierConfig**](LoyaltyTierConfig.md) | | [optional] | | **expiration** | [**LoyaltyTierExpiration**](LoyaltyTierExpiration.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the loyalty. | [default to 'loyalty_tier'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the loyalty. | [optional][default to 'loyalty_tier'] | diff --git a/docs/LoyaltyTierAllOfConfig.md b/docs/LoyaltyTierAllOfConfig.md deleted file mode 100644 index 9bdea992..00000000 --- a/docs/LoyaltyTierAllOfConfig.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::LoyaltyTierAllOfConfig - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **points** | [**LoyaltyTierAllOfConfigPoints**](LoyaltyTierAllOfConfigPoints.md) | | | - diff --git a/docs/LoyaltyTierAllOfConfigPoints.md b/docs/LoyaltyTierAllOfConfigPoints.md deleted file mode 100644 index 1848a12b..00000000 --- a/docs/LoyaltyTierAllOfConfigPoints.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::LoyaltyTierAllOfConfigPoints - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **from** | **Integer** | Bottom points threshold value. | [optional] | -| **to** | **Integer** | Top points threshold value. | [optional] | - diff --git a/docs/LoyaltyTierBase.md b/docs/LoyaltyTierBase.md index 3420eaee..49a8721f 100644 --- a/docs/LoyaltyTierBase.md +++ b/docs/LoyaltyTierBase.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Loyalty Tier name. | | +| **name** | **String** | Loyalty Tier name. | [optional] | | **earning_rules** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] | | **rewards** | [**Hash<String, MappingPoints>**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] | -| **points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | | +| **points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | [optional] | diff --git a/docs/LoyaltyTierConfig.md b/docs/LoyaltyTierConfig.md new file mode 100644 index 00000000..526d85d5 --- /dev/null +++ b/docs/LoyaltyTierConfig.md @@ -0,0 +1,8 @@ +# VoucherifySdk::LoyaltyTierConfig + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | [**LoyaltyTierConfigPoints**](LoyaltyTierConfigPoints.md) | | [optional] | + diff --git a/docs/LoyaltyTierConfigPoints.md b/docs/LoyaltyTierConfigPoints.md new file mode 100644 index 00000000..7e71286a --- /dev/null +++ b/docs/LoyaltyTierConfigPoints.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyTierConfigPoints + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **Integer** | Bottom points threshold value. | [optional] | +| **to** | **Integer** | Top points threshold value. | [optional] | + diff --git a/docs/LoyaltyTierExpiration.md b/docs/LoyaltyTierExpiration.md index 7e63f5f6..ef3dc958 100644 --- a/docs/LoyaltyTierExpiration.md +++ b/docs/LoyaltyTierExpiration.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **campaign_id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **tier_id** | **String** | Unique tier ID, assigned by Voucherify. | | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **campaign_id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **tier_id** | **String** | Unique tier ID, assigned by Voucherify. | [optional] | | **start_date** | **String** | Activation timestamp defines when the loyalty tier starts to be active in ISO 8601 format. Loyalty tier is inactive before this date. | [optional] | | **expiration_date** | **String** | Expiration timestamp defines when the loyalty tier expires in ISO 8601 format. Loyalty tier is inactive after this date. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/LoyaltyTierPoints.md b/docs/LoyaltyTierPoints.md new file mode 100644 index 00000000..672ac72c --- /dev/null +++ b/docs/LoyaltyTierPoints.md @@ -0,0 +1,9 @@ +# VoucherifySdk::LoyaltyTierPoints + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **Integer** | Bottom points threshold value. | [optional] | +| **to** | **Integer** | Top points threshold value. | [optional] | + diff --git a/docs/LoyaltyTiersExpirationAll.md b/docs/LoyaltyTiersExpirationAll.md index 2a1c0d0d..e79a02d7 100644 --- a/docs/LoyaltyTiersExpirationAll.md +++ b/docs/LoyaltyTiersExpirationAll.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **qualification_type** | **String** | Tier qualification. `BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold. | | +| **qualification_type** | **String** | Tier qualification. `BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold. | [optional] | | **qualification_period** | **String** | Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. | **Period** | **Definition** | |:---|:---| | **Calendar Month** | Points collected in one calendar month<br>January, February, March, etc. | | **Calendar Quarter** | Points collected in the quarter<br>- January - March<br>- April - June<br>- July - September<br>- October - December | | **Calendar Half-year** | Points collected in the half-year<br>- January - June<br>- July - December | | **Calendar Year** | Points collected in one calendar year<br>January - December | | [optional] | -| **start_date** | [**LoyaltyTiersExpirationAllStartDate**](LoyaltyTiersExpirationAllStartDate.md) | | | -| **expiration_date** | [**LoyaltyTiersExpirationAllExpirationDate**](LoyaltyTiersExpirationAllExpirationDate.md) | | | +| **start_date** | [**LoyaltyTiersExpirationAllStartDate**](LoyaltyTiersExpirationAllStartDate.md) | | [optional] | +| **expiration_date** | [**LoyaltyTiersExpirationAllExpirationDate**](LoyaltyTiersExpirationAllExpirationDate.md) | | [optional] | diff --git a/docs/LoyaltyTiersExpirationAllExpirationDate.md b/docs/LoyaltyTiersExpirationAllExpirationDate.md index 8194f87a..a0a748d1 100644 --- a/docs/LoyaltyTiersExpirationAllExpirationDate.md +++ b/docs/LoyaltyTiersExpirationAllExpirationDate.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | What triggers the tier to expire for a customer. `END_OF_PERIOD`: Expire tier at the end of the period. `END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier. | | -| **extend** | **String** | Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day. | | +| **type** | **String** | What triggers the tier to expire for a customer. `END_OF_PERIOD`: Expire tier at the end of the period. `END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier. | [optional] | +| **extend** | **String** | Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day. | [optional] | | **rounding** | [**LoyaltyTiersExpirationAllExpirationDateRounding**](LoyaltyTiersExpirationAllExpirationDateRounding.md) | | [optional] | diff --git a/docs/LoyaltyTiersExpirationAllStartDate.md b/docs/LoyaltyTiersExpirationAllStartDate.md index 54758b0b..f104cd18 100644 --- a/docs/LoyaltyTiersExpirationAllStartDate.md +++ b/docs/LoyaltyTiersExpirationAllStartDate.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | What triggers the tier to be valid for a customer. `IMMEDIATE`: After reaching the minimum required points. `NEXT_PERIOD`: When the next qualification period starts. | | +| **type** | **String** | What triggers the tier to be valid for a customer. `IMMEDIATE`: After reaching the minimum required points. `NEXT_PERIOD`: When the next qualification period starts. | [optional] | diff --git a/docs/MappingFixed.md b/docs/MappingFixed.md deleted file mode 100644 index 8414ebf9..00000000 --- a/docs/MappingFixed.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::MappingFixed - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of calculation. | [optional][default to 'CUSTOM'] | -| **points** | **Integer** | Fixed number of points to be applied. | [optional] | - diff --git a/docs/MappingMultiply.md b/docs/MappingMultiply.md deleted file mode 100644 index 0522c401..00000000 --- a/docs/MappingMultiply.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::MappingMultiply - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of calculation. | [optional][default to 'MULTIPLY'] | -| **multiplier** | **Float** | Multiplication factor used to multiply the points to obtain the mapped points. | [optional] | - diff --git a/docs/MappingPoints.md b/docs/MappingPoints.md index 7643e432..a793dcd8 100644 --- a/docs/MappingPoints.md +++ b/docs/MappingPoints.md @@ -1,49 +1,10 @@ # VoucherifySdk::MappingPoints -## Class instance methods +## Properties -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::MappingPoints.openapi_one_of -# => -# [ -# :'MappingFixed', -# :'MappingMultiply' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::MappingPoints.build(data) -# => # - -VoucherifySdk::MappingPoints.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `MappingFixed` -- `MappingMultiply` -- `nil` (if no type matches) +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **multiplier** | **Float** | Multiplication factor used to multiply the points to obtain the mapped points. | [optional] | +| **points** | **Integer** | Fixed number of points to be applied. | [optional] | diff --git a/docs/MemberActivity.md b/docs/MemberActivity.md new file mode 100644 index 00000000..6edf9f45 --- /dev/null +++ b/docs/MemberActivity.md @@ -0,0 +1,12 @@ +# VoucherifySdk::MemberActivity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique event ID, assigned by Voucherify. | [optional] | +| **type** | **String** | Event type. | [optional] | +| **data** | **Object** | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the member activity occurred in ISO 8601 format. | [optional] | +| **group_id** | **String** | Unique identifier of the request that caused the event. | [optional] | + diff --git a/docs/Order.md b/docs/Order.md index ca6015e3..0d85f9d3 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -4,16 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | | **items** | [**Array<OrderItem>**](OrderItem.md) | Array of items applied to the order. | [optional] | -| **customer** | [**Customer**](Customer.md) | | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | -| **referrer** | [**Referrer**](Referrer.md) | | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | diff --git a/docs/OrderBase.md b/docs/OrderBase.md deleted file mode 100644 index 2a4a3491..00000000 --- a/docs/OrderBase.md +++ /dev/null @@ -1,17 +0,0 @@ -# VoucherifySdk::OrderBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | -| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **items** | [**Array<OrderItem>**](OrderItem.md) | Array of items applied to the order. | [optional] | -| **customer** | [**Customer**](Customer.md) | | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | -| **referrer** | [**Referrer**](Referrer.md) | | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | - diff --git a/docs/OrderCalculated.md b/docs/OrderCalculated.md index 52eb5c35..a69b8949 100644 --- a/docs/OrderCalculated.md +++ b/docs/OrderCalculated.md @@ -5,9 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | | **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | @@ -18,12 +16,14 @@ | **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | | **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | | **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **items** | [**Array<OrderItemCalculated>**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **referrer_id** | **String** | Unique referrer ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | -| **redemptions** | [**Hash<String, OrderRedemptions>**](OrderRedemptions.md) | | [optional] | -| **customer** | [**OrderCalculatedCustomer**](OrderCalculatedCustomer.md) | | [optional] | -| **referrer** | [**OrderCalculatedReferrer**](OrderCalculatedReferrer.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | +| **customer** | [**CustomerId**](CustomerId.md) | | [optional] | +| **referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] | +| **redemptions** | [**Hash<String, OrderRedemptionsEntry>**](OrderRedemptionsEntry.md) | | [optional] | diff --git a/docs/OrderCalculatedBase.md b/docs/OrderCalculatedBase.md deleted file mode 100644 index f854c271..00000000 --- a/docs/OrderCalculatedBase.md +++ /dev/null @@ -1,27 +0,0 @@ -# VoucherifySdk::OrderCalculatedBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | -| **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | -| **items_discount_amount** | **Integer** | Sum of all product-specific discounts applied to the order. | [optional] | -| **total_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] | -| **total_amount** | **Integer** | Order amount after undoing all the discounts through the rollback redemption. | [optional] | -| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | -| **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | -| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **items** | [**Array<OrderItemCalculated>**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **referrer_id** | **String** | Unique referrer ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | -| **redemptions** | [**Hash<String, OrderRedemptions>**](OrderRedemptions.md) | | [optional] | - diff --git a/docs/OrderCalculatedCustomer.md b/docs/OrderCalculatedCustomer.md deleted file mode 100644 index 246db826..00000000 --- a/docs/OrderCalculatedCustomer.md +++ /dev/null @@ -1,49 +0,0 @@ -# VoucherifySdk::OrderCalculatedCustomer - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::OrderCalculatedCustomer.openapi_one_of -# => -# [ -# :'CustomerId', -# :'CustomerWithSummaryLoyaltyReferrals' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::OrderCalculatedCustomer.build(data) -# => # - -VoucherifySdk::OrderCalculatedCustomer.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `CustomerId` -- `CustomerWithSummaryLoyaltyReferrals` -- `nil` (if no type matches) - diff --git a/docs/OrderCalculatedItem.md b/docs/OrderCalculatedItem.md new file mode 100644 index 00000000..6dc64a3a --- /dev/null +++ b/docs/OrderCalculatedItem.md @@ -0,0 +1,28 @@ +# VoucherifySdk::OrderCalculatedItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of the order line item. | [optional] | +| **sku_id** | **String** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] | +| **product_id** | **String** | Unique identifier of the product. It is assigned by Voucherify. | [optional] | +| **related_object** | **String** | Used along with the source_id property, can be set to either sku or product. | [optional] | +| **source_id** | **String** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] | +| **quantity** | **Integer** | The quantity of the particular item in the cart. | [optional] | +| **discount_quantity** | **Integer** | Number of dicounted items. | [optional] | +| **initial_quantity** | **Integer** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] | +| **amount** | **Integer** | The total amount of the order item (price * quantity). | [optional] | +| **discount_amount** | **Integer** | Sum of all order-item-level discounts applied to the order. | [optional] | +| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | +| **applied_discount_quantity** | **Integer** | Number of the discounted items applied in the transaction. | [optional] | +| **applied_quantity** | **Integer** | Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] | +| **applied_quantity_amount** | **Integer** | Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] | +| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **price** | **Integer** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | +| **subtotal_amount** | **Integer** | Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` | [optional] | +| **product** | [**OrderCalculatedItemProduct**](OrderCalculatedItemProduct.md) | | [optional] | +| **sku** | [**OrderCalculatedItemSku**](OrderCalculatedItemSku.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order_item'] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. | [optional] | + diff --git a/docs/OrderCalculatedItemProduct.md b/docs/OrderCalculatedItemProduct.md new file mode 100644 index 00000000..ab30a7e7 --- /dev/null +++ b/docs/OrderCalculatedItemProduct.md @@ -0,0 +1,13 @@ +# VoucherifySdk::OrderCalculatedItemProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] | +| **source_id** | **String** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] | +| **override** | **Boolean** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] | +| **name** | **String** | Product name. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] | +| **price** | **Float** | Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | + diff --git a/docs/OrderCalculatedItemSku.md b/docs/OrderCalculatedItemSku.md new file mode 100644 index 00000000..d6ee0ded --- /dev/null +++ b/docs/OrderCalculatedItemSku.md @@ -0,0 +1,12 @@ +# VoucherifySdk::OrderCalculatedItemSku + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] | +| **source_id** | **String** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] | +| **override** | **Boolean** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] | +| **sku** | **String** | The SKU name. | [optional] | +| **price** | **Float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | + diff --git a/docs/OrderCalculatedNoCustomerData.md b/docs/OrderCalculatedNoCustomerData.md deleted file mode 100644 index d5f1af7c..00000000 --- a/docs/OrderCalculatedNoCustomerData.md +++ /dev/null @@ -1,29 +0,0 @@ -# VoucherifySdk::OrderCalculatedNoCustomerData - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | -| **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | -| **items_discount_amount** | **Integer** | Sum of all product-specific discounts applied to the order. | [optional] | -| **total_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] | -| **total_amount** | **Integer** | Order amount after undoing all the discounts through the rollback redemption. | [optional] | -| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | -| **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | -| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **items** | [**Array<OrderItemCalculated>**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **referrer_id** | **String** | Unique referrer ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | -| **redemptions** | [**Hash<String, OrderRedemptions>**](OrderRedemptions.md) | | [optional] | -| **customer** | [**CustomerId**](CustomerId.md) | | [optional] | -| **referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] | - diff --git a/docs/OrderCalculatedReferrer.md b/docs/OrderCalculatedReferrer.md deleted file mode 100644 index e1b1095c..00000000 --- a/docs/OrderCalculatedReferrer.md +++ /dev/null @@ -1,49 +0,0 @@ -# VoucherifySdk::OrderCalculatedReferrer - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::OrderCalculatedReferrer.openapi_one_of -# => -# [ -# :'ReferrerId', -# :'ReferrerWithSummaryLoyaltyReferrals' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::OrderCalculatedReferrer.build(data) -# => # - -VoucherifySdk::OrderCalculatedReferrer.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ReferrerId` -- `ReferrerWithSummaryLoyaltyReferrals` -- `nil` (if no type matches) - diff --git a/docs/OrderItem.md b/docs/OrderItem.md index afecf1c1..f9c9b6f0 100644 --- a/docs/OrderItem.md +++ b/docs/OrderItem.md @@ -4,18 +4,18 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **sku_id** | **String** | A unique SKU ID assigned by Voucherify. | [optional] | -| **product_id** | **String** | A unique product ID assigned by Voucherify. | [optional] | +| **sku_id** | **String** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] | +| **product_id** | **String** | Unique identifier of the product. It is assigned by Voucherify. | [optional] | | **related_object** | **String** | Used along with the source_id property, can be set to either sku or product. | [optional] | -| **source_id** | **String** | The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] | +| **source_id** | **String** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] | | **quantity** | **Integer** | The quantity of the particular item in the cart. | [optional] | | **discount_quantity** | **Integer** | Number of dicounted items. | [optional] | | **initial_quantity** | **Integer** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] | | **amount** | **Integer** | The total amount of the order item (price * quantity). | [optional] | -| **discount_amount** | **Integer** | Sum of all order-item-level discounts applied to the order. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-item-level discounts applied to the order. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **price** | **Integer** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | | **product** | [**OrderItemProduct**](OrderItemProduct.md) | | [optional] | | **sku** | [**OrderItemSku**](OrderItemSku.md) | | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. | [optional] | diff --git a/docs/OrderItemCalculated.md b/docs/OrderItemCalculated.md deleted file mode 100644 index 2a5e5852..00000000 --- a/docs/OrderItemCalculated.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::OrderItemCalculated - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **sku_id** | **String** | A unique SKU ID assigned by Voucherify. | [optional] | -| **product_id** | **String** | A unique product ID assigned by Voucherify. | [optional] | -| **related_object** | **String** | Used along with the source_id property, can be set to either sku or product. | [optional] | -| **source_id** | **String** | The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] | -| **quantity** | **Integer** | The quantity of the particular item in the cart. | [optional] | -| **discount_quantity** | **Integer** | Number of dicounted items. | [optional] | -| **initial_quantity** | **Integer** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] | -| **amount** | **Integer** | The total amount of the order item (price * quantity). | [optional] | -| **discount_amount** | **Integer** | Sum of all order-item-level discounts applied to the order. | [optional] | -| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | -| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **price** | **Integer** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | -| **subtotal_amount** | **Integer** | Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` | [optional] | -| **product** | [**OrderItemProduct**](OrderItemProduct.md) | | [optional] | -| **sku** | [**OrderItemSku**](OrderItemSku.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'order_item'] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. | [optional] | - diff --git a/docs/OrderItemProduct.md b/docs/OrderItemProduct.md index 0fb40bf6..886cf7bf 100644 --- a/docs/OrderItemProduct.md +++ b/docs/OrderItemProduct.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] | -| **source_id** | **String** | The merchant’s product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] | +| **source_id** | **String** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] | | **override** | **Boolean** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] | | **name** | **String** | Product name. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] | diff --git a/docs/OrderItemSku.md b/docs/OrderItemSku.md index e0052426..092c58d9 100644 --- a/docs/OrderItemSku.md +++ b/docs/OrderItemSku.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] | -| **source_id** | **String** | The merchant’s SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] | +| **source_id** | **String** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] | | **override** | **Boolean** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] | | **sku** | **String** | The SKU name. | [optional] | | **price** | **Float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | diff --git a/docs/OrderRedemptions.md b/docs/OrderRedemptions.md deleted file mode 100644 index b49da7f2..00000000 --- a/docs/OrderRedemptions.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::OrderRedemptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **date** | **Time** | Timestamp representing the date and time when the redemption was created in ISO 8601 format. | [optional] | -| **rollback_id** | **String** | Unique ID of the redemption rollback. | [optional] | -| **rollback_date** | **Time** | Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format. | [optional] | -| **related_object_type** | **String** | The source of the incentive. | [optional][default to 'redemption'] | -| **related_object_id** | **String** | Unique ID of the parent redemption. | [optional] | -| **related_object_parent_id** | **String** | Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. | [optional] | -| **stacked** | **Array<String>** | Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. | [optional] | -| **rollback_stacked** | **Array<String>** | Lists the rollback redemption IDs of the particular child redemptions. | [optional] | - diff --git a/docs/OrderRedemptionsEntry.md b/docs/OrderRedemptionsEntry.md new file mode 100644 index 00000000..7465647b --- /dev/null +++ b/docs/OrderRedemptionsEntry.md @@ -0,0 +1,15 @@ +# VoucherifySdk::OrderRedemptionsEntry + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **Time** | Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. | [optional] | +| **rollback_id** | **String** | Unique ID of the redemption rollback. | [optional] | +| **rollback_date** | **Time** | Timestamp representing the date and tiem when the redemption rollback was created. The value is shown in the ISO 8601 format. | [optional] | +| **related_object_type** | **String** | The source of the incentive. | [optional][default to 'redemption'] | +| **related_object_id** | **String** | Unique ID of the parent redemption. | [optional] | +| **related_object_parent_id** | **String** | Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. | [optional] | +| **stacked** | **Array<String>** | Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. | [optional] | +| **rollback_stacked** | **Array<String>** | Lists the rollback redemption IDs of the particular child redemptions. | [optional] | + diff --git a/docs/OrdersApi.md b/docs/OrdersApi.md index f1f8d46f..cae7d86a 100644 --- a/docs/OrdersApi.md +++ b/docs/OrdersApi.md @@ -278,8 +278,8 @@ end api_instance = VoucherifySdk::OrdersApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrderListOrders::CREATED_AT # ParameterOrderListOrders | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. } @@ -296,8 +296,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrderListOrders**](.md) | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type diff --git a/docs/OrdersCreateRequestBody.md b/docs/OrdersCreateRequestBody.md index cd9a4906..e3a13f84 100644 --- a/docs/OrdersCreateRequestBody.md +++ b/docs/OrdersCreateRequestBody.md @@ -7,13 +7,13 @@ | **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | | **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | | **items** | [**Array<OrderItem>**](OrderItem.md) | Array of items applied to the order. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | | **referrer** | [**Referrer**](Referrer.md) | | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | diff --git a/docs/OrdersCreateResponseBody.md b/docs/OrdersCreateResponseBody.md index bed08297..61e0c65e 100644 --- a/docs/OrdersCreateResponseBody.md +++ b/docs/OrdersCreateResponseBody.md @@ -5,9 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | | **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | @@ -18,12 +16,14 @@ | **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | | **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | | **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **items** | [**Array<OrderItemCalculated>**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **referrer_id** | **String** | Unique referrer ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | -| **redemptions** | [**Hash<String, OrderRedemptions>**](OrderRedemptions.md) | | [optional] | -| **customer** | [**OrderCalculatedCustomer**](OrderCalculatedCustomer.md) | | [optional] | -| **referrer** | [**OrderCalculatedReferrer**](OrderCalculatedReferrer.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | +| **customer** | [**CustomerId**](CustomerId.md) | | [optional] | +| **referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] | +| **redemptions** | [**Hash<String, OrderRedemptionsEntry>**](OrderRedemptionsEntry.md) | | [optional] | diff --git a/docs/OrdersExportCreateResponseBody.md b/docs/OrdersExportCreateResponseBody.md index 7770238a..fb60b429 100644 --- a/docs/OrdersExportCreateResponseBody.md +++ b/docs/OrdersExportCreateResponseBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the export. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the export. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional][default to 'SCHEDULED'] | | **channel** | **String** | The channel through which the export was triggered. | [optional] | -| **result** | **Object** | Contains the URL of the CSV file. | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | | -| **exported_object** | **String** | The type of object to be exported. | [default to 'order'] | -| **parameters** | [**OrdersExportCreateRequestBodyParameters**](OrdersExportCreateRequestBodyParameters.md) | | [optional] | +| **result** | **Object** | Contains the URL of the CSV file. | [optional] | +| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] | +| **exported_object** | **String** | The type of object to be exported. | [optional][default to 'order'] | +| **parameters** | [**OrdersExportCreateResponseBodyParameters**](OrdersExportCreateResponseBodyParameters.md) | | [optional] | diff --git a/docs/OrdersExportCreateResponseBodyParameters.md b/docs/OrdersExportCreateResponseBodyParameters.md new file mode 100644 index 00000000..ff944e39 --- /dev/null +++ b/docs/OrdersExportCreateResponseBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::OrdersExportCreateResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order** | [**ExportOrderOrder**](ExportOrderOrder.md) | | [optional] | +| **fields** | [**Array<ExportOrderFields>**](ExportOrderFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] | +| **filters** | **Object** | Allowed additional properties must start with \"metadata.\" | [optional] | + diff --git a/docs/OrdersGetResponseBody.md b/docs/OrdersGetResponseBody.md index fd3d1788..85f55d66 100644 --- a/docs/OrdersGetResponseBody.md +++ b/docs/OrdersGetResponseBody.md @@ -5,9 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | | **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | @@ -18,12 +16,14 @@ | **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | | **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | | **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **items** | [**Array<OrderItemCalculated>**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **referrer_id** | **String** | Unique referrer ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | -| **redemptions** | [**Hash<String, OrderRedemptions>**](OrderRedemptions.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | | **customer** | [**CustomerId**](CustomerId.md) | | [optional] | | **referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] | +| **redemptions** | [**Hash<String, OrderRedemptionsEntry>**](OrderRedemptionsEntry.md) | | [optional] | diff --git a/docs/OrdersImportCreateRequestBodyItem.md b/docs/OrdersImportCreateRequestBodyItem.md index 7d1bcb4f..59037f9b 100644 --- a/docs/OrdersImportCreateRequestBodyItem.md +++ b/docs/OrdersImportCreateRequestBodyItem.md @@ -4,15 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | | **items** | [**Array<OrderItem>**](OrderItem.md) | Array of items applied to the order. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | | **referrer** | [**Referrer**](Referrer.md) | | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | diff --git a/docs/OrdersImportCreateResponseBody.md b/docs/OrdersImportCreateResponseBody.md index 6bc775a3..9be0166c 100644 --- a/docs/OrdersImportCreateResponseBody.md +++ b/docs/OrdersImportCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/OrdersListResponseBody.md b/docs/OrdersListResponseBody.md index 37a32af9..2c3436ef 100644 --- a/docs/OrdersListResponseBody.md +++ b/docs/OrdersListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about orders in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of order objects. | [default to 'orders'] | -| **orders** | [**Array<OrderCalculatedNoCustomerData>**](OrderCalculatedNoCustomerData.md) | Contains array of order objects. | | -| **total** | **Integer** | Total number of orders. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about orders in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of order objects. | [optional][default to 'orders'] | +| **orders** | [**Array<OrderCalculated>**](OrderCalculated.md) | Contains array of order objects. | [optional] | +| **total** | **Integer** | Total number of orders. | [optional] | diff --git a/docs/OrdersUpdateRequestBody.md b/docs/OrdersUpdateRequestBody.md index b2c1c1f5..9f28ea12 100644 --- a/docs/OrdersUpdateRequestBody.md +++ b/docs/OrdersUpdateRequestBody.md @@ -4,14 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | | **items** | [**Array<OrderItem>**](OrderItem.md) | Array of items applied to the order. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | | **referrer** | [**Referrer**](Referrer.md) | | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | diff --git a/docs/OrdersUpdateResponseBody.md b/docs/OrdersUpdateResponseBody.md index 681671d2..f5c0b94c 100644 --- a/docs/OrdersUpdateResponseBody.md +++ b/docs/OrdersUpdateResponseBody.md @@ -5,9 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | | **status** | **String** | The order status. | [optional] | | **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | | **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | @@ -18,12 +16,14 @@ | **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | | **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | | **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **items** | [**Array<OrderItemCalculated>**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | | -| **referrer_id** | **String** | Unique referrer ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | -| **redemptions** | [**Hash<String, OrderRedemptions>**](OrderRedemptions.md) | | [optional] | -| **customer** | [**OrderCalculatedCustomer**](OrderCalculatedCustomer.md) | | [optional] | -| **referrer** | [**OrderCalculatedReferrer**](OrderCalculatedReferrer.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | +| **customer** | [**CustomerId**](CustomerId.md) | | [optional] | +| **referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] | +| **redemptions** | [**Hash<String, OrderRedemptionsEntry>**](OrderRedemptionsEntry.md) | | [optional] | diff --git a/docs/ParameterActivityCategory.md b/docs/ParameterActivityCategory.md new file mode 100644 index 00000000..73bdd1bb --- /dev/null +++ b/docs/ParameterActivityCategory.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterActivityCategory + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterCreatedBeforeAfter.md b/docs/ParameterCreatedBeforeAfter.md index 8927678f..2a944fc2 100644 --- a/docs/ParameterCreatedBeforeAfter.md +++ b/docs/ParameterCreatedBeforeAfter.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **before** | **Time** | Timestamp representing the date and time before the voucher was created in ISO 8601 format. | [optional] | -| **after** | **Time** | Timestamp representing the date and time after the voucher was created in ISO 8601 format. | [optional] | +| **before** | **Time** | Timestamp representing the date and time before the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **after** | **Time** | Timestamp representing the date and time after the voucher was created. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/ParameterFiltersListCustomerRedeemables.md b/docs/ParameterFiltersListCustomerRedeemables.md new file mode 100644 index 00000000..b769239e --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemables.md @@ -0,0 +1,15 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemables + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | [**ParameterFiltersListCustomerRedeemablesId**](ParameterFiltersListCustomerRedeemablesId.md) | | [optional] | +| **created_at** | [**ParameterFiltersListCustomerRedeemablesCreatedAt**](ParameterFiltersListCustomerRedeemablesCreatedAt.md) | | [optional] | +| **redeemable_id** | [**ParameterFiltersListCustomerRedeemablesRedeemableId**](ParameterFiltersListCustomerRedeemablesRedeemableId.md) | | [optional] | +| **redeemable_object** | [**ParameterFiltersListCustomerRedeemablesRedeemableObject**](ParameterFiltersListCustomerRedeemablesRedeemableObject.md) | | [optional] | +| **holder_role** | [**ParameterFiltersListCustomerRedeemablesHolderRole**](ParameterFiltersListCustomerRedeemablesHolderRole.md) | | [optional] | +| **campaign_id** | [**ParameterFiltersListCustomerRedeemablesCampaignId**](ParameterFiltersListCustomerRedeemablesCampaignId.md) | | [optional] | +| **campaign_type** | [**ParameterFiltersListCustomerRedeemablesCampaignType**](ParameterFiltersListCustomerRedeemablesCampaignType.md) | | [optional] | +| **voucher_type** | [**ParameterFiltersListCustomerRedeemablesVoucherType**](ParameterFiltersListCustomerRedeemablesVoucherType.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesCampaignId.md b/docs/ParameterFiltersListCustomerRedeemablesCampaignId.md new file mode 100644 index 00000000..26f92497 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCampaignId.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesCampaignId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesCampaignType.md b/docs/ParameterFiltersListCustomerRedeemablesCampaignType.md new file mode 100644 index 00000000..6e65f9fc --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCampaignType.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesCampaignType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**ParameterFiltersListCustomerRedeemablesCampaignTypeConditions**](ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md b/docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md new file mode 100644 index 00000000..61a30f14 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md @@ -0,0 +1,15 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesCampaignTypeConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **not_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **is** | **String** | Value is exactly this value (single value). | [optional] | +| **is_not** | **String** | Results omit this value (single value). | [optional] | +| **has_value** | **String** | Value is NOT null. The value for this parameter is an empty string. | [optional] | +| **is_unknown** | **String** | Value is null. The value for this parameter is an empty string. | [optional] | +| **starts_with** | **String** | Value starts with the specified string. | [optional] | +| **ends_with** | **String** | Value ends with the specified string. | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md b/docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md new file mode 100644 index 00000000..ccc90c08 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesCreatedAt + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**ParameterFiltersListCustomerRedeemablesCreatedAtConditions**](ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md b/docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md new file mode 100644 index 00000000..34c0a3a6 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md @@ -0,0 +1,13 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesCreatedAtConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **after** | **Time** | Value is after this date. The value for this parameter is shown in the ISO 8601 format. | [optional] | +| **before** | **Time** | Value is before this date. The value for this parameter is shown in the ISO 8601 format. | [optional] | +| **has_value** | **String** | Value is NOT null. The value for this parameter is an empty string. | [optional] | +| **is_unknown** | **String** | Value is null. The value for this parameter is an empty string. | [optional] | +| **more_than** | **Integer** | Value is more days ago before the current date and time, e.g. more than `10` days ago. | [optional] | +| **less_than** | **Integer** | Value is less days before the current date and time, e.g. less than `10` days ago. | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesHolderRole.md b/docs/ParameterFiltersListCustomerRedeemablesHolderRole.md new file mode 100644 index 00000000..054a0f65 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesHolderRole.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesHolderRole + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**ParameterFiltersListCustomerRedeemablesHolderRoleConditions**](ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md b/docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md new file mode 100644 index 00000000..b579cc96 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md @@ -0,0 +1,15 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesHolderRoleConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **not_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **is** | **String** | Value is exactly this value (single value). | [optional] | +| **is_not** | **String** | Results omit this value (single value). | [optional] | +| **has_value** | **String** | Value is NOT null. The value for this parameter is an empty string. | [optional] | +| **is_unknown** | **String** | Value is null. The value for this parameter is an empty string. | [optional] | +| **starts_with** | **String** | Value starts with the specified string. | [optional] | +| **ends_with** | **String** | Value ends with the specified string. | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesId.md b/docs/ParameterFiltersListCustomerRedeemablesId.md new file mode 100644 index 00000000..f6919642 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesId.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md b/docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md new file mode 100644 index 00000000..85563cb8 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesRedeemableId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md new file mode 100644 index 00000000..d4390617 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesRedeemableObject + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions**](ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md new file mode 100644 index 00000000..3b08c86a --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md @@ -0,0 +1,15 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **not_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **is** | **String** | Value is exactly this value (single value). | [optional][default to 'voucher'] | +| **is_not** | **String** | Results omit this value (single value). | [optional][default to 'voucher'] | +| **has_value** | **String** | Value is NOT null. The value for this parameter is an empty string. | [optional] | +| **is_unknown** | **String** | Value is null. The value for this parameter is an empty string. | [optional] | +| **starts_with** | **String** | Value starts with the specified string. | [optional] | +| **ends_with** | **String** | Value ends with the specified string. | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesVoucherType.md b/docs/ParameterFiltersListCustomerRedeemablesVoucherType.md new file mode 100644 index 00000000..0dcda5e4 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesVoucherType.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesVoucherType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**ParameterFiltersListCustomerRedeemablesVoucherTypeConditions**](ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md) | | [optional] | +| **junction** | [**Junction**](Junction.md) | | [optional] | + diff --git a/docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md b/docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md new file mode 100644 index 00000000..162ef478 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md @@ -0,0 +1,15 @@ +# VoucherifySdk::ParameterFiltersListCustomerRedeemablesVoucherTypeConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **not_in** | **Array<String>** | Array of resource values that should be included in the results (multiple values). | [optional] | +| **is** | **String** | Value is exactly this value (single value). | [optional] | +| **is_not** | **String** | Results omit this value (single value). | [optional] | +| **has_value** | **String** | Value is NOT null. The value for this parameter is an empty string. | [optional] | +| **is_unknown** | **String** | Value is null. The value for this parameter is an empty string. | [optional] | +| **starts_with** | **String** | Value starts with the specified string. | [optional] | +| **ends_with** | **String** | Value ends with the specified string. | [optional] | + diff --git a/docs/ParameterOrderCreatedAt.md b/docs/ParameterOrderCreatedAt.md new file mode 100644 index 00000000..1f41a54c --- /dev/null +++ b/docs/ParameterOrderCreatedAt.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterOrderCreatedAt + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterOrderListEarningRules.md b/docs/ParameterOrderListEarningRules.md new file mode 100644 index 00000000..54d310fb --- /dev/null +++ b/docs/ParameterOrderListEarningRules.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterOrderListEarningRules + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterOrderListPromotionTiers.md b/docs/ParameterOrderListPromotionTiers.md new file mode 100644 index 00000000..3331b2c4 --- /dev/null +++ b/docs/ParameterOrderListPromotionTiers.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterOrderListPromotionTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterOrderListPromotionTiersClientSide.md b/docs/ParameterOrderListPromotionTiersClientSide.md new file mode 100644 index 00000000..544f7e11 --- /dev/null +++ b/docs/ParameterOrderListPromotionTiersClientSide.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterOrderListPromotionTiersClientSide + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterOrderListRedeemables.md b/docs/ParameterOrderListRedeemables.md new file mode 100644 index 00000000..81f0acf6 --- /dev/null +++ b/docs/ParameterOrderListRedeemables.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterOrderListRedeemables + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterOrderVouchers.md b/docs/ParameterOrderVouchers.md new file mode 100644 index 00000000..9103aefe --- /dev/null +++ b/docs/ParameterOrderVouchers.md @@ -0,0 +1,7 @@ +# VoucherifySdk::ParameterOrderVouchers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/ParameterUpdatedBeforeAfter.md b/docs/ParameterUpdatedBeforeAfter.md index 0c3c45a5..ff4dea3c 100644 --- a/docs/ParameterUpdatedBeforeAfter.md +++ b/docs/ParameterUpdatedBeforeAfter.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **before** | **Time** | Timestamp representing the date and time before the voucher was updated in ISO 8601 format. | [optional] | -| **after** | **Time** | Timestamp representing the date and time after the voucher was updated in ISO 8601 format. | [optional] | +| **before** | **Time** | Timestamp representing the date and time before the voucher was updated. The value is shown in the ISO 8601 format. | [optional] | +| **after** | **Time** | Timestamp representing the date and time after the voucher was updated. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/Product.md b/docs/Product.md index acc0d332..86178b24 100644 --- a/docs/Product.md +++ b/docs/Product.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID assigned by Voucherify. | | -| **source_id** | **String** | Unique product source ID. | | -| **name** | **String** | Unique user-defined product name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | +| **id** | **String** | Unique product ID assigned by Voucherify. | [optional] | +| **source_id** | **String** | Unique product source ID. | [optional] | +| **name** | **String** | Unique user-defined product name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | +| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] | | **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the product. | [default to 'product'] | +| **created_at** | **Time** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the product. | [optional][default to 'product'] | | **skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] | diff --git a/docs/ProductCollectionsApi.md b/docs/ProductCollectionsApi.md index 2a020cc5..919b383f 100644 --- a/docs/ProductCollectionsApi.md +++ b/docs/ProductCollectionsApi.md @@ -39,7 +39,7 @@ end api_instance = VoucherifySdk::ProductCollectionsApi.new opts = { - product_collections_create_request_body: VoucherifySdk::ProductCollectionsCreateDynamicRequestBody.new({type: 'AUTO_UPDATE', name: 'name_example', filter: VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyFilter.new({junction: VoucherifySdk::Junction::AND})}) # ProductCollectionsCreateRequestBody | + product_collections_create_request_body: VoucherifySdk::ProductCollectionsCreateRequestBody.new # ProductCollectionsCreateRequestBody | } begin @@ -214,8 +214,8 @@ end api_instance = VoucherifySdk::ProductCollectionsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrder::CREATED_AT # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. } @@ -232,8 +232,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrder**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type @@ -279,8 +279,8 @@ end api_instance = VoucherifySdk::ProductCollectionsApi.new product_collection_id = 'product_collection_id_example' # String | Unique product collection ID. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrder::CREATED_AT, # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. starting_after: Time.parse('2013-10-20T19:20:30+01:00') # Time | Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. } @@ -299,8 +299,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **product_collection_id** | **String** | Unique product collection ID. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrder**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | | **starting_after** | **Time** | Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. | [optional] | diff --git a/docs/ProductCollectionsCreateDynamicRequestBody.md b/docs/ProductCollectionsCreateDynamicRequestBody.md deleted file mode 100644 index 20b62c3f..00000000 --- a/docs/ProductCollectionsCreateDynamicRequestBody.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ProductCollectionsCreateDynamicRequestBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Show that the product collection is dynamic (products come in and leave based on set criteria). | [default to 'AUTO_UPDATE'] | -| **name** | **String** | Unique user-defined product collection name. | | -| **filter** | [**ProductCollectionsCreateDynamicRequestBodyFilter**](ProductCollectionsCreateDynamicRequestBodyFilter.md) | | | - diff --git a/docs/ProductCollectionsCreateDynamicRequestBodyFilter.md b/docs/ProductCollectionsCreateDynamicRequestBodyFilter.md deleted file mode 100644 index 18b91215..00000000 --- a/docs/ProductCollectionsCreateDynamicRequestBodyFilter.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyFilter - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **junction** | [**Junction**](Junction.md) | | | -| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **name** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **price** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **object** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **skus** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | -| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | - diff --git a/docs/ProductCollectionsCreateDynamicRequestBodyProductsItem.md b/docs/ProductCollectionsCreateDynamicRequestBodyProductsItem.md deleted file mode 100644 index 83f13f30..00000000 --- a/docs/ProductCollectionsCreateDynamicRequestBodyProductsItem.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyProductsItem - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | The product ID. | | -| **product_id** | **String** | Product ID for SKUs. | [optional] | -| **object** | **String** | Denotes the type of object represented by the ID. | | - diff --git a/docs/ProductCollectionsCreateRequestBody.md b/docs/ProductCollectionsCreateRequestBody.md index 03461f1c..6f952890 100644 --- a/docs/ProductCollectionsCreateRequestBody.md +++ b/docs/ProductCollectionsCreateRequestBody.md @@ -1,49 +1,11 @@ # VoucherifySdk::ProductCollectionsCreateRequestBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ProductCollectionsCreateRequestBody.openapi_one_of -# => -# [ -# :'ProductCollectionsCreateDynamicRequestBody', -# :'ProductCollectionsCreateStaticRequestBody' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ProductCollectionsCreateRequestBody.build(data) -# => # - -VoucherifySdk::ProductCollectionsCreateRequestBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ProductCollectionsCreateDynamicRequestBody` -- `ProductCollectionsCreateStaticRequestBody` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Show that the product collection is static (manually selected products). | [optional][default to 'STATIC'] | +| **name** | **String** | Unique user-defined product collection name. | [optional] | +| **products** | [**Array<ProductCollectionsCreateRequestBodyProductsItem>**](ProductCollectionsCreateRequestBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | +| **filter** | [**ProductCollectionsCreateRequestBodyFilter**](ProductCollectionsCreateRequestBodyFilter.md) | | [optional] | diff --git a/docs/ProductCollectionsCreateRequestBodyFilter.md b/docs/ProductCollectionsCreateRequestBodyFilter.md new file mode 100644 index 00000000..373e32fe --- /dev/null +++ b/docs/ProductCollectionsCreateRequestBodyFilter.md @@ -0,0 +1,20 @@ +# VoucherifySdk::ProductCollectionsCreateRequestBodyFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | | +| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **name** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **price** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **object** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **skus** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ProductCollectionsCreateRequestBodyProductsItem.md b/docs/ProductCollectionsCreateRequestBodyProductsItem.md new file mode 100644 index 00000000..6b3ab459 --- /dev/null +++ b/docs/ProductCollectionsCreateRequestBodyProductsItem.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ProductCollectionsCreateRequestBodyProductsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The product ID. | | +| **product_id** | **String** | Product ID for SKUs. | [optional] | +| **object** | **String** | Denotes the type of the object represented by the ID. | | + diff --git a/docs/ProductCollectionsCreateResponseBody.md b/docs/ProductCollectionsCreateResponseBody.md index bae7cac0..7c488ce5 100644 --- a/docs/ProductCollectionsCreateResponseBody.md +++ b/docs/ProductCollectionsCreateResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Product collection ID. | | -| **name** | **String** | Unique user-defined product collection name. | | -| **type** | **String** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | | -| **filter** | [**ProductCollectionsCreateDynamicRequestBodyFilter**](ProductCollectionsCreateDynamicRequestBodyFilter.md) | | [optional] | -| **products** | [**Array<ProductCollectionsItemProductsItem>**](ProductCollectionsItemProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product collection was created in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the static product collection. | [default to 'products_collection'] | +| **id** | **String** | Product collection ID. | [optional] | +| **name** | **String** | Unique user-defined product collection name. | [optional] | +| **type** | **String** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] | +| **filter** | [**ProductCollectionsCreateResponseBodyFilter**](ProductCollectionsCreateResponseBodyFilter.md) | | [optional] | +| **products** | [**Array<ProductCollectionsCreateResponseBodyProductsItem>**](ProductCollectionsCreateResponseBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional][default to 'products_collection'] | diff --git a/docs/ProductCollectionsCreateResponseBodyFilter.md b/docs/ProductCollectionsCreateResponseBodyFilter.md new file mode 100644 index 00000000..2c7a3ad0 --- /dev/null +++ b/docs/ProductCollectionsCreateResponseBodyFilter.md @@ -0,0 +1,20 @@ +# VoucherifySdk::ProductCollectionsCreateResponseBodyFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | | +| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **name** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **price** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **object** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **skus** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ProductCollectionsCreateResponseBodyProductsItem.md b/docs/ProductCollectionsCreateResponseBodyProductsItem.md new file mode 100644 index 00000000..c25d5d5e --- /dev/null +++ b/docs/ProductCollectionsCreateResponseBodyProductsItem.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ProductCollectionsCreateResponseBodyProductsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The product ID. | | +| **product_id** | **String** | Product ID for SKUs. | [optional] | +| **object** | **String** | Denotes the type of the object represented by the ID. | | + diff --git a/docs/ProductCollectionsCreateStaticRequestBody.md b/docs/ProductCollectionsCreateStaticRequestBody.md deleted file mode 100644 index ec6e107b..00000000 --- a/docs/ProductCollectionsCreateStaticRequestBody.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ProductCollectionsCreateStaticRequestBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Show that the product collection is static (manually selected products). | [default to 'STATIC'] | -| **name** | **String** | Unique user-defined product collection name. | | -| **products** | [**Array<ProductCollectionsCreateDynamicRequestBodyProductsItem>**](ProductCollectionsCreateDynamicRequestBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | - diff --git a/docs/ProductCollectionsGetResponseBody.md b/docs/ProductCollectionsGetResponseBody.md index cb485064..5cb9b34e 100644 --- a/docs/ProductCollectionsGetResponseBody.md +++ b/docs/ProductCollectionsGetResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Product collection ID. | | -| **name** | **String** | Unique user-defined product collection name. | | -| **type** | **String** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | | -| **filter** | [**ProductCollectionsCreateDynamicRequestBodyFilter**](ProductCollectionsCreateDynamicRequestBodyFilter.md) | | [optional] | -| **products** | [**Array<ProductCollectionsItemProductsItem>**](ProductCollectionsItemProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product collection was created in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the static product collection. | [default to 'products_collection'] | +| **id** | **String** | Product collection ID. | [optional] | +| **name** | **String** | Unique user-defined product collection name. | [optional] | +| **type** | **String** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] | +| **filter** | [**ProductCollectionsGetResponseBodyFilter**](ProductCollectionsGetResponseBodyFilter.md) | | [optional] | +| **products** | [**Array<ProductCollectionsGetResponseBodyProductsItem>**](ProductCollectionsGetResponseBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional][default to 'products_collection'] | diff --git a/docs/ProductCollectionsGetResponseBodyFilter.md b/docs/ProductCollectionsGetResponseBodyFilter.md new file mode 100644 index 00000000..a65dffb5 --- /dev/null +++ b/docs/ProductCollectionsGetResponseBodyFilter.md @@ -0,0 +1,20 @@ +# VoucherifySdk::ProductCollectionsGetResponseBodyFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | | +| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **name** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **price** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **object** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **skus** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ProductCollectionsGetResponseBodyProductsItem.md b/docs/ProductCollectionsGetResponseBodyProductsItem.md new file mode 100644 index 00000000..9e5415be --- /dev/null +++ b/docs/ProductCollectionsGetResponseBodyProductsItem.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ProductCollectionsGetResponseBodyProductsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The product ID. | | +| **product_id** | **String** | Product ID for SKUs. | [optional] | +| **object** | **String** | Denotes the type of the object represented by the ID. | | + diff --git a/docs/ProductCollectionsItem.md b/docs/ProductCollectionsItem.md index 2ffba218..504d3e1a 100644 --- a/docs/ProductCollectionsItem.md +++ b/docs/ProductCollectionsItem.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Product collection ID. | | -| **name** | **String** | Unique user-defined product collection name. | | -| **type** | **String** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | | -| **filter** | [**ProductCollectionsCreateDynamicRequestBodyFilter**](ProductCollectionsCreateDynamicRequestBodyFilter.md) | | [optional] | +| **id** | **String** | Product collection ID. | [optional] | +| **name** | **String** | Unique user-defined product collection name. | [optional] | +| **type** | **String** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] | +| **filter** | [**ProductCollectionsItemFilter**](ProductCollectionsItemFilter.md) | | [optional] | | **products** | [**Array<ProductCollectionsItemProductsItem>**](ProductCollectionsItemProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product collection was created in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the static product collection. | [default to 'products_collection'] | +| **created_at** | **Time** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional][default to 'products_collection'] | diff --git a/docs/ProductCollectionsItemFilter.md b/docs/ProductCollectionsItemFilter.md new file mode 100644 index 00000000..8a2baccb --- /dev/null +++ b/docs/ProductCollectionsItemFilter.md @@ -0,0 +1,20 @@ +# VoucherifySdk::ProductCollectionsItemFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **junction** | [**Junction**](Junction.md) | | | +| **id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **name** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **price** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **object** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **skus** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | +| **updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] | + diff --git a/docs/ProductCollectionsItemProductsItem.md b/docs/ProductCollectionsItemProductsItem.md index 6bdf11bb..6f48ac93 100644 --- a/docs/ProductCollectionsItemProductsItem.md +++ b/docs/ProductCollectionsItemProductsItem.md @@ -6,5 +6,5 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | The product ID. | | | **product_id** | **String** | Product ID for SKUs. | [optional] | -| **object** | **String** | Denotes the type of object represented by the ID. | | +| **object** | **String** | Denotes the type of the object represented by the ID. | | diff --git a/docs/ProductCollectionsList.md b/docs/ProductCollectionsList.md deleted file mode 100644 index 217f06cb..00000000 --- a/docs/ProductCollectionsList.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::ProductCollectionsList - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about product collections. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of product collections. | [default to 'data'] | -| **data** | [**Array<ProductCollectionsItem>**](ProductCollectionsItem.md) | A dictionary that contains an array of product collections and their details. | | -| **total** | **Integer** | Total number of product collections. | | - diff --git a/docs/ProductCollectionsListResponseBody.md b/docs/ProductCollectionsListResponseBody.md index e7b28025..4733768f 100644 --- a/docs/ProductCollectionsListResponseBody.md +++ b/docs/ProductCollectionsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about product collections. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of product collections. | [default to 'data'] | -| **data** | [**Array<ProductCollectionsItem>**](ProductCollectionsItem.md) | A dictionary that contains an array of product collections and their details. | | -| **total** | **Integer** | Total number of product collections. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about product collections. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of product collections. | [optional][default to 'data'] | +| **data** | [**Array<ProductCollectionsItem>**](ProductCollectionsItem.md) | A dictionary that contains an array of product collections and their details. | [optional] | +| **total** | **Integer** | Total number of product collections. | [optional] | diff --git a/docs/ProductCollectionsProductsList.md b/docs/ProductCollectionsProductsList.md deleted file mode 100644 index 54347bbe..00000000 --- a/docs/ProductCollectionsProductsList.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::ProductCollectionsProductsList - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about products and SKUs. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of products and SKUs. | [default to 'data'] | -| **data** | [**Array<ProductCollectionsProductsListProductsItem>**](ProductCollectionsProductsListProductsItem.md) | A dictionary that contains an array of products and SKUs. | | -| **total** | **Integer** | Total number of products & SKUs in the product collection. | | - diff --git a/docs/ProductCollectionsProductsListProductsItem.md b/docs/ProductCollectionsProductsListProductsItem.md deleted file mode 100644 index 0689433d..00000000 --- a/docs/ProductCollectionsProductsListProductsItem.md +++ /dev/null @@ -1,49 +0,0 @@ -# VoucherifySdk::ProductCollectionsProductsListProductsItem - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ProductCollectionsProductsListProductsItem.openapi_one_of -# => -# [ -# :'ProductWithoutSkus', -# :'SkuWithProduct' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ProductCollectionsProductsListProductsItem.build(data) -# => # - -VoucherifySdk::ProductCollectionsProductsListProductsItem.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ProductWithoutSkus` -- `SkuWithProduct` -- `nil` (if no type matches) - diff --git a/docs/ProductCollectionsProductsListResponseBody.md b/docs/ProductCollectionsProductsListResponseBody.md index 10d883cd..82ef9954 100644 --- a/docs/ProductCollectionsProductsListResponseBody.md +++ b/docs/ProductCollectionsProductsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about products and SKUs. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of products and SKUs. | [default to 'data'] | -| **data** | [**Array<ProductCollectionsProductsListProductsItem>**](ProductCollectionsProductsListProductsItem.md) | A dictionary that contains an array of products and SKUs. | | -| **total** | **Integer** | Total number of products & SKUs in the product collection. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about products and SKUs. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of products and SKUs. | [optional][default to 'data'] | +| **data** | [**Array<ProductCollectionsProductsListResponseBodyDataItem>**](ProductCollectionsProductsListResponseBodyDataItem.md) | | [optional] | +| **total** | **Integer** | Total number of products & SKUs in the product collection. | [optional] | diff --git a/docs/ProductCollectionsProductsListResponseBodyDataItem.md b/docs/ProductCollectionsProductsListResponseBodyDataItem.md new file mode 100644 index 00000000..d4b9aef6 --- /dev/null +++ b/docs/ProductCollectionsProductsListResponseBodyDataItem.md @@ -0,0 +1,21 @@ +# VoucherifySdk::ProductCollectionsProductsListResponseBodyDataItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **source_id** | **String** | | [optional] | +| **name** | **String** | Unique user-defined product name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | +| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | +| **metadata** | **Object** | | [optional] | +| **image_url** | **String** | | [optional] | +| **created_at** | **String** | | [optional] | +| **updated_at** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **product_id** | **String** | The parent product's unique ID. | [optional] | +| **sku** | **String** | Unique user-defined SKU name. | [optional] | +| **currency** | **String** | SKU price currency. | [optional] | +| **product** | [**ProductWithoutSkus**](ProductWithoutSkus.md) | | [optional] | + diff --git a/docs/ProductWithoutSkus.md b/docs/ProductWithoutSkus.md index 81455ecb..097ff607 100644 --- a/docs/ProductWithoutSkus.md +++ b/docs/ProductWithoutSkus.md @@ -4,14 +4,14 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID assigned by Voucherify. | | -| **source_id** | **String** | Unique product source ID. | | -| **name** | **String** | Unique user-defined product name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | +| **id** | **String** | Unique product ID assigned by Voucherify. | [optional] | +| **source_id** | **String** | Unique product source ID. | [optional] | +| **name** | **String** | Unique user-defined product name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | +| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] | | **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the product. | [default to 'product'] | +| **created_at** | **Time** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the product. | [optional][default to 'product'] | diff --git a/docs/ProductsApi.md b/docs/ProductsApi.md index 422a0ada..be7e1400 100644 --- a/docs/ProductsApi.md +++ b/docs/ProductsApi.md @@ -15,8 +15,8 @@ All URIs are relative to *https://api.voucherify.io* | [**list_products**](ProductsApi.md#list_products) | **GET** /v1/products | List Products | | [**list_skus_in_product**](ProductsApi.md#list_skus_in_product) | **GET** /v1/products/{productId}/skus | List SKUs in Product | | [**update_product**](ProductsApi.md#update_product) | **PUT** /v1/products/{productId} | Update Product | -| [**update_products_in_bulk**](ProductsApi.md#update_products_in_bulk) | **POST** /v1/products/bulk/async | Update Products in bulk | -| [**update_products_metadata_in_bulk**](ProductsApi.md#update_products_metadata_in_bulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in bulk | +| [**update_products_in_bulk**](ProductsApi.md#update_products_in_bulk) | **POST** /v1/products/bulk/async | Update Products in Bulk | +| [**update_products_metadata_in_bulk**](ProductsApi.md#update_products_metadata_in_bulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in Bulk | | [**update_sku**](ProductsApi.md#update_sku) | **PUT** /v1/products/{productId}/skus/{skuId} | Update SKU | @@ -148,7 +148,7 @@ end Delete Product -This method deletes a product. +Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. ### Examples @@ -171,7 +171,7 @@ end api_instance = VoucherifySdk::ProductsApi.new product_id = 'product_id_example' # String | A Voucherify product ID or source ID. opts = { - force: true # Boolean | If this flag is set to true, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same source_id. + force: true # Boolean | If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. } begin @@ -187,7 +187,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **product_id** | **String** | A Voucherify product ID or source ID. | | -| **force** | **Boolean** | If this flag is set to true, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same source_id. | [optional] | +| **force** | **Boolean** | If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. | [optional] | ### Return type @@ -209,7 +209,7 @@ nil (empty response body) Delete SKU -This method deletes a product SKU. +Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. ### Examples @@ -233,7 +233,7 @@ api_instance = VoucherifySdk::ProductsApi.new product_id = 'product_id_example' # String | A unique Voucherify product ID or product source ID. sku_id = 'sku_id_example' # String | A Voucherify SKU ID or SKU source ID. opts = { - force: true # Boolean | If this flag is set to true, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same source_id. + force: true # Boolean | If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. } begin @@ -250,7 +250,7 @@ end | ---- | ---- | ----------- | ----- | | **product_id** | **String** | A unique Voucherify product ID or product source ID. | | | **sku_id** | **String** | A Voucherify SKU ID or SKU source ID. | | -| **force** | **Boolean** | If this flag is set to true, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same source_id. | [optional] | +| **force** | **Boolean** | If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. | [optional] | ### Return type @@ -384,7 +384,7 @@ end ## import_products_using_csv -> import_products_using_csv(file) +> import_products_using_csv(opts) Import Products using CSV @@ -409,11 +409,13 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::ProductsApi.new -file = File.new('/path/to/some/file') # File | File path. +opts = { + file: File.new('/path/to/some/file') # File | File path. +} begin # Import Products using CSV - result = api_instance.import_products_using_csv(file) + result = api_instance.import_products_using_csv(opts) p result rescue VoucherifySdk::ApiError => e puts "Error when calling ProductsApi->import_products_using_csv: #{e}" @@ -424,7 +426,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **file** | **File** | File path. | | +| **file** | **File** | File path. | [optional] | ### Return type @@ -442,7 +444,7 @@ end ## import_skus_using_csv -> import_skus_using_csv(file) +> import_skus_using_csv(opts) Import SKUs using CSV @@ -467,11 +469,13 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::ProductsApi.new -file = File.new('/path/to/some/file') # File | File path. +opts = { + file: File.new('/path/to/some/file') # File | File path. +} begin # Import SKUs using CSV - result = api_instance.import_skus_using_csv(file) + result = api_instance.import_skus_using_csv(opts) p result rescue VoucherifySdk::ApiError => e puts "Error when calling ProductsApi->import_skus_using_csv: #{e}" @@ -482,7 +486,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **file** | **File** | File path. | | +| **file** | **File** | File path. | [optional] | ### Return type @@ -526,8 +530,8 @@ end api_instance = VoucherifySdk::ProductsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrder::CREATED_AT, # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. start_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. end_date: Time.parse('2013-10-20T19:20:30+01:00') # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -546,8 +550,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrder**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | | **start_date** | **Time** | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | | **end_date** | **Time** | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | @@ -595,8 +599,8 @@ end api_instance = VoucherifySdk::ProductsApi.new product_id = 'product_id_example' # String | A Voucherify product ID or product source ID. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrder::CREATED_AT, # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. start_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. end_date: Time.parse('2013-10-20T19:20:30+01:00') # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -616,8 +620,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **product_id** | **String** | A Voucherify product ID or product source ID. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrder**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | | **start_date** | **Time** | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | | **end_date** | **Time** | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | @@ -702,9 +706,9 @@ end > update_products_in_bulk(opts) -Update Products in bulk +Update Products in Bulk -Update several products in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. +Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. ### Examples @@ -726,11 +730,11 @@ end api_instance = VoucherifySdk::ProductsApi.new opts = { - products_update_in_bulk_request_body: [VoucherifySdk::ProductsUpdateInBulkRequestBody.new({source_id: 'test_prod_id_1'})] # Array | Create an array of product objects, each with the parameters which you want to update. + products_update_in_bulk_request_body: [VoucherifySdk::ProductsUpdateInBulkRequestBody.new] # Array | List the product fields to be updated in each customer object. } begin - # Update Products in bulk + # Update Products in Bulk result = api_instance.update_products_in_bulk(opts) p result rescue VoucherifySdk::ApiError => e @@ -742,7 +746,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **products_update_in_bulk_request_body** | [**Array<ProductsUpdateInBulkRequestBody>**](ProductsUpdateInBulkRequestBody.md) | Create an array of product objects, each with the parameters which you want to update. | [optional] | +| **products_update_in_bulk_request_body** | [**Array<ProductsUpdateInBulkRequestBody>**](ProductsUpdateInBulkRequestBody.md) | List the product fields to be updated in each customer object. | [optional] | ### Return type @@ -762,9 +766,9 @@ end > update_products_metadata_in_bulk(opts) -Update Products' Metadata in bulk +Update Products' Metadata in Bulk -Update several product metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. +Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. ### Examples @@ -786,11 +790,11 @@ end api_instance = VoucherifySdk::ProductsApi.new opts = { - products_metadata_update_in_bulk_request_body: VoucherifySdk::ProductsMetadataUpdateInBulkRequestBody.new({source_ids: ['source_ids_example'], metadata: 3.56}) # ProductsMetadataUpdateInBulkRequestBody | Specify the list of product source IDs and the metadata key value pairs to be udpated for these products. + products_metadata_update_in_bulk_request_body: VoucherifySdk::ProductsMetadataUpdateInBulkRequestBody.new # ProductsMetadataUpdateInBulkRequestBody | List the source_ids of the products you would like to update with the metadata key/value pairs. } begin - # Update Products' Metadata in bulk + # Update Products' Metadata in Bulk result = api_instance.update_products_metadata_in_bulk(opts) p result rescue VoucherifySdk::ApiError => e @@ -802,7 +806,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **products_metadata_update_in_bulk_request_body** | [**ProductsMetadataUpdateInBulkRequestBody**](ProductsMetadataUpdateInBulkRequestBody.md) | Specify the list of product source IDs and the metadata key value pairs to be udpated for these products. | [optional] | +| **products_metadata_update_in_bulk_request_body** | [**ProductsMetadataUpdateInBulkRequestBody**](ProductsMetadataUpdateInBulkRequestBody.md) | List the source_ids of the products you would like to update with the metadata key/value pairs. | [optional] | ### Return type diff --git a/docs/ProductsCreateResponseBody.md b/docs/ProductsCreateResponseBody.md index 82448bc5..a3fff4a3 100644 --- a/docs/ProductsCreateResponseBody.md +++ b/docs/ProductsCreateResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID assigned by Voucherify. | | -| **source_id** | **String** | Unique product source ID. | | -| **name** | **String** | Unique user-defined product name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | +| **id** | **String** | Unique product ID assigned by Voucherify. | [optional] | +| **source_id** | **String** | Unique product source ID. | [optional] | +| **name** | **String** | Unique user-defined product name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | +| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] | | **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the product. | [default to 'product'] | +| **created_at** | **Time** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the product. | [optional][default to 'product'] | | **skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] | diff --git a/docs/ProductsGetResponseBody.md b/docs/ProductsGetResponseBody.md index 12e6d10c..ab18318c 100644 --- a/docs/ProductsGetResponseBody.md +++ b/docs/ProductsGetResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID assigned by Voucherify. | | -| **source_id** | **String** | Unique product source ID. | | -| **name** | **String** | Unique user-defined product name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | +| **id** | **String** | Unique product ID assigned by Voucherify. | [optional] | +| **source_id** | **String** | Unique product source ID. | [optional] | +| **name** | **String** | Unique user-defined product name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | +| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] | | **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the product. | [default to 'product'] | +| **created_at** | **Time** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the product. | [optional][default to 'product'] | | **skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] | diff --git a/docs/ProductsImportCsvCreateResponseBody.md b/docs/ProductsImportCsvCreateResponseBody.md index cf6a8028..17474ad1 100644 --- a/docs/ProductsImportCsvCreateResponseBody.md +++ b/docs/ProductsImportCsvCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/ProductsListResponseBody.md b/docs/ProductsListResponseBody.md index 5543fcbf..f7e20133 100644 --- a/docs/ProductsListResponseBody.md +++ b/docs/ProductsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about products in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of product objects. | [default to 'products'] | -| **products** | [**Array<Product>**](Product.md) | Contains array of product objects. | | -| **total** | **Integer** | Total number of product objects. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about products in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of product objects. | [optional][default to 'products'] | +| **products** | [**Array<Product>**](Product.md) | Contains array of product objects. | [optional] | +| **total** | **Integer** | Total number of product objects. | [optional] | diff --git a/docs/ProductsMetadataUpdateInBulkRequestBody.md b/docs/ProductsMetadataUpdateInBulkRequestBody.md index 8860c912..df0a3f44 100644 --- a/docs/ProductsMetadataUpdateInBulkRequestBody.md +++ b/docs/ProductsMetadataUpdateInBulkRequestBody.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **source_ids** | **Array<String>** | Array of unique product source IDs. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | +| **source_ids** | **Array<String>** | Array of unique product source IDs. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] | diff --git a/docs/ProductsMetadataUpdateInBulkResponseBody.md b/docs/ProductsMetadataUpdateInBulkResponseBody.md index 8f3e0722..cf2c6d0b 100644 --- a/docs/ProductsMetadataUpdateInBulkResponseBody.md +++ b/docs/ProductsMetadataUpdateInBulkResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/ProductsSkusCreateResponseBody.md b/docs/ProductsSkusCreateResponseBody.md index 2cd7546a..e9d3a4cd 100644 --- a/docs/ProductsSkusCreateResponseBody.md +++ b/docs/ProductsSkusCreateResponseBody.md @@ -4,16 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | | -| **source_id** | **String** | A unique SKU identifier from your inventory system. | | -| **product_id** | **String** | The parent product's unique ID. | | -| **sku** | **String** | Unique user-defined SKU name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | +| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] | +| **source_id** | **String** | A unique SKU identifier from your inventory system. | [optional] | +| **product_id** | **String** | The parent product's unique ID. | [optional] | +| **sku** | **String** | Unique user-defined SKU name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | | **currency** | **String** | SKU price currency. | [optional] | -| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `SKU`. | [default to 'sku'] | +| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional][default to 'sku'] | diff --git a/docs/ProductsSkusListResponseBody.md b/docs/ProductsSkusListResponseBody.md index a060691a..d6f316b6 100644 --- a/docs/ProductsSkusListResponseBody.md +++ b/docs/ProductsSkusListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about SKUs. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of SKUs. | [default to 'data'] | -| **skus** | [**Array<Sku>**](Sku.md) | A dictionary that contains an array of SKUs. | | -| **total** | **Integer** | Total number of SKUs in the product. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about SKUs. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of SKUs. | [optional][default to 'data'] | +| **skus** | [**Array<Sku>**](Sku.md) | A dictionary that contains an array of SKUs. | [optional] | +| **total** | **Integer** | Total number of SKUs in the product. | [optional] | diff --git a/docs/ProductsSkusUpdateResponseBody.md b/docs/ProductsSkusUpdateResponseBody.md index e34a6306..f3598133 100644 --- a/docs/ProductsSkusUpdateResponseBody.md +++ b/docs/ProductsSkusUpdateResponseBody.md @@ -4,16 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | | -| **source_id** | **String** | A unique SKU identifier from your inventory system. | | -| **product_id** | **String** | The parent product's unique ID. | | -| **sku** | **String** | Unique user-defined SKU name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | +| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] | +| **source_id** | **String** | A unique SKU identifier from your inventory system. | [optional] | +| **product_id** | **String** | The parent product's unique ID. | [optional] | +| **sku** | **String** | Unique user-defined SKU name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | | **currency** | **String** | SKU price currency. | [optional] | -| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `SKU`. | [default to 'sku'] | +| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional][default to 'sku'] | diff --git a/docs/ProductsUpdateInBulkRequestBody.md b/docs/ProductsUpdateInBulkRequestBody.md index 9c7e80be..8b90787b 100644 --- a/docs/ProductsUpdateInBulkRequestBody.md +++ b/docs/ProductsUpdateInBulkRequestBody.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **source_id** | **String** | Unique product source ID from your inventory system. | | +| **source_id** | **String** | Unique product source ID from your inventory system. | [optional] | | **name** | **String** | Unique user-defined product name. | [optional] | | **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | | **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | diff --git a/docs/ProductsUpdateInBulkResponseBody.md b/docs/ProductsUpdateInBulkResponseBody.md index 024e90fb..00da2174 100644 --- a/docs/ProductsUpdateInBulkResponseBody.md +++ b/docs/ProductsUpdateInBulkResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/ProductsUpdateResponseBody.md b/docs/ProductsUpdateResponseBody.md index 86f14961..9a47ce29 100644 --- a/docs/ProductsUpdateResponseBody.md +++ b/docs/ProductsUpdateResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID assigned by Voucherify. | | -| **source_id** | **String** | Unique product source ID. | | -| **name** | **String** | Unique user-defined product name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | +| **id** | **String** | Unique product ID assigned by Voucherify. | [optional] | +| **source_id** | **String** | Unique product source ID. | [optional] | +| **name** | **String** | Unique user-defined product name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | +| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] | | **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the product. | [default to 'product'] | +| **created_at** | **Time** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the product. | [optional][default to 'product'] | | **skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] | diff --git a/docs/PromotionStack.md b/docs/PromotionStack.md index e63704a0..34c294a7 100644 --- a/docs/PromotionStack.md +++ b/docs/PromotionStack.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Promotion stack name. | | -| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | | -| **id** | **String** | Unique promotion stack ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format. | [optional] | -| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'promotion_stack'] | -| **category_id** | **String** | Promotion stack category ID. | | -| **categories** | [**Array<Category>**](Category.md) | Details about the category assigned to the promotion stack. | | +| **name** | **String** | Promotion stack name. | [optional] | +| **tiers** | [**PromotionStackTiers**](PromotionStackTiers.md) | | [optional] | +| **id** | **String** | Unique promotion stack ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] | +| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'promotion_stack'] | +| **category_id** | **String** | Promotion stack category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Details about the category assigned to the promotion stack. | [optional] | diff --git a/docs/PromotionStackBase.md b/docs/PromotionStackBase.md index b5a29bb6..330616e8 100644 --- a/docs/PromotionStackBase.md +++ b/docs/PromotionStackBase.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Promotion stack name. | | -| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | | +| **name** | **String** | Promotion stack name. | [optional] | +| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | [optional] | diff --git a/docs/PromotionStackBaseTiers.md b/docs/PromotionStackBaseTiers.md index e2b1f378..87738235 100644 --- a/docs/PromotionStackBaseTiers.md +++ b/docs/PromotionStackBaseTiers.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | | +| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | [optional] | | **hierarchy_mode** | **String** | | [optional][default to 'MANUAL'] | diff --git a/docs/PromotionStackTiers.md b/docs/PromotionStackTiers.md new file mode 100644 index 00000000..b7206526 --- /dev/null +++ b/docs/PromotionStackTiers.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionStackTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | [optional] | +| **hierarchy_mode** | **String** | | [optional][default to 'MANUAL'] | + diff --git a/docs/PromotionTier.md b/docs/PromotionTier.md index 7c143425..7db31c0b 100644 --- a/docs/PromotionTier.md +++ b/docs/PromotionTier.md @@ -5,8 +5,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique promotion tier ID. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | | **name** | **String** | Name of the promotion tier. | [optional] | | **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | | **action** | [**PromotionTierAction**](PromotionTierAction.md) | | [optional] | @@ -18,10 +18,11 @@ | **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | | **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**PromotionTierValidityTimeframe**](PromotionTierValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **summary** | [**PromotionTierSummary**](PromotionTierSummary.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | | **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | | **category_id** | **String** | Promotion tier category ID. | [optional] | | **categories** | [**Array<Category>**](Category.md) | | [optional] | diff --git a/docs/PromotionTierCampaign.md b/docs/PromotionTierCampaign.md index 2d62fe92..45ecd5aa 100644 --- a/docs/PromotionTierCampaign.md +++ b/docs/PromotionTierCampaign.md @@ -7,9 +7,10 @@ | **id** | **String** | Unique campaign ID. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**PromotionTierCampaignValidityTimeframe**](PromotionTierCampaignValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | | **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | -| **object** | **String** | The type of object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | diff --git a/docs/PromotionTierCampaignValidityTimeframe.md b/docs/PromotionTierCampaignValidityTimeframe.md deleted file mode 100644 index fb2eb0a0..00000000 --- a/docs/PromotionTierCampaignValidityTimeframe.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::PromotionTierCampaignValidityTimeframe - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **interval** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day. | [optional] | -| **duration** | **String** | Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day. | [optional] | - diff --git a/docs/PromotionTierCreateParams.md b/docs/PromotionTierCreateParams.md index e6d2630d..44f9251a 100644 --- a/docs/PromotionTierCreateParams.md +++ b/docs/PromotionTierCreateParams.md @@ -4,17 +4,18 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Name of the promotion tier. | | +| **name** | **String** | Name of the promotion tier. | [optional] | | **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | -| **action** | [**PromotionTierAction**](PromotionTierAction.md) | | [optional] | +| **action** | [**PromotionTierCreateParamsAction**](PromotionTierCreateParamsAction.md) | | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | | **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] | | **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | | **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | | **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**PromotionTierValidityTimeframe**](PromotionTierValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **category** | **String** | Assign category to the promotion tier. | [optional] | | **category_id** | **String** | Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`. | [optional] | diff --git a/docs/PromotionTierCreateParamsAction.md b/docs/PromotionTierCreateParamsAction.md new file mode 100644 index 00000000..6a8a351d --- /dev/null +++ b/docs/PromotionTierCreateParamsAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionTierCreateParamsAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionTierValidityTimeframe.md b/docs/PromotionTierValidityTimeframe.md deleted file mode 100644 index 0e43f522..00000000 --- a/docs/PromotionTierValidityTimeframe.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::PromotionTierValidityTimeframe - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **interval** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day. | [optional] | -| **duration** | **String** | Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day. | [optional] | - diff --git a/docs/PromotionTiersList.md b/docs/PromotionTiersList.md index 52bbf623..09a12432 100644 --- a/docs/PromotionTiersList.md +++ b/docs/PromotionTiersList.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional][default to 'list'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional][default to 'list'] | | **data_ref** | **String** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional][default to 'tiers'] | | **tiers** | [**Array<PromotionTier>**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] | | **total** | **Integer** | Total number of promotion tiers. | [optional] | -| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | diff --git a/docs/PromotionsApi.md b/docs/PromotionsApi.md index 70c8b35f..a9396f4b 100644 --- a/docs/PromotionsApi.md +++ b/docs/PromotionsApi.md @@ -4,6 +4,7 @@ All URIs are relative to *https://api.voucherify.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**add_promotion_tier_to_campaign**](PromotionsApi.md#add_promotion_tier_to_campaign) | **POST** /v1/promotions/{campaignId}/tiers | Add Promotion Tier to Campaign | | [**create_promotion_stack**](PromotionsApi.md#create_promotion_stack) | **POST** /v1/promotions/{campaignId}/stacks | Create Promotion Stack | | [**delete_promotion_stack**](PromotionsApi.md#delete_promotion_stack) | **DELETE** /v1/promotions/{campaignId}/stacks/{stackId} | Delete Promotion Stack | | [**delete_promotion_tier**](PromotionsApi.md#delete_promotion_tier) | **DELETE** /v1/promotions/tiers/{promotionTierId} | Delete Promotion Tier | @@ -13,8 +14,72 @@ All URIs are relative to *https://api.voucherify.io* | [**get_promotion_tier**](PromotionsApi.md#get_promotion_tier) | **GET** /v1/promotions/tiers/{promotionTierId} | Get Promotion Tier | | [**list_all_promotion_stacks**](PromotionsApi.md#list_all_promotion_stacks) | **GET** /v1/promotions/stacks | List Promotion Stacks | | [**list_promotion_stacks_in_campaign**](PromotionsApi.md#list_promotion_stacks_in_campaign) | **GET** /v1/promotions/{campaignId}/stacks | List Promotion Stacks in Campaign | +| [**list_promotion_tiers**](PromotionsApi.md#list_promotion_tiers) | **GET** /v1/promotions/tiers | List Promotion Tiers | | [**list_promotion_tiers_from_campaign**](PromotionsApi.md#list_promotion_tiers_from_campaign) | **GET** /v1/promotions/{campaignId}/tiers | List Promotion Tiers from Campaign | | [**update_promotion_stack**](PromotionsApi.md#update_promotion_stack) | **PUT** /v1/promotions/{campaignId}/stacks/{stackId} | Update Promotion Stack | +| [**update_promotion_tier**](PromotionsApi.md#update_promotion_tier) | **PUT** /v1/promotions/tiers/{promotionTierId} | Update Promotion Tier | + + +## add_promotion_tier_to_campaign + +> add_promotion_tier_to_campaign(campaign_id, opts) + +Add Promotion Tier to Campaign + +This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::PromotionsApi.new +campaign_id = 'campaign_id_example' # String | Unique campaign ID assigned by Voucherify. +opts = { + promotions_tiers_create_request_body: VoucherifySdk::PromotionsTiersCreateRequestBody.new # PromotionsTiersCreateRequestBody | Specify the promotion tier parameters. +} + +begin + # Add Promotion Tier to Campaign + result = api_instance.add_promotion_tier_to_campaign(campaign_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling PromotionsApi->add_promotion_tier_to_campaign: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign_id** | **String** | Unique campaign ID assigned by Voucherify. | | +| **promotions_tiers_create_request_body** | [**PromotionsTiersCreateRequestBody**](PromotionsTiersCreateRequestBody.md) | Specify the promotion tier parameters. | [optional] | + +### Return type + +[**PromotionsTiersCreateResponseBody**](PromotionsTiersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json ## create_promotion_stack @@ -46,7 +111,7 @@ end api_instance = VoucherifySdk::PromotionsApi.new campaign_id = 'campaign_id_example' # String | Unique campaign ID. opts = { - promotions_stacks_create_request_body: VoucherifySdk::PromotionsStacksCreateRequestBody.new({name: 'name_example', tiers: VoucherifySdk::PromotionStackBaseTiers.new({ids: ['ids_example']})}) # PromotionsStacksCreateRequestBody | Specify the order of promotion tiers for the promotion stack. + promotions_stacks_create_request_body: VoucherifySdk::PromotionsStacksCreateRequestBody.new # PromotionsStacksCreateRequestBody | Specify the order of promotion tiers for the promotion stack. } begin @@ -457,8 +522,8 @@ end api_instance = VoucherifySdk::PromotionsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrderListAllPromotionStacks::CREATED_AT, # ParameterOrderListAllPromotionStacks | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. created_at: VoucherifySdk::ParameterCreatedBeforeAfter.new, # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z updated_at: VoucherifySdk::ParameterUpdatedBeforeAfter.new # ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z @@ -477,8 +542,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrderListAllPromotionStacks**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | | **created_at** | [**ParameterCreatedBeforeAfter**](.md) | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | | **updated_at** | [**ParameterUpdatedBeforeAfter**](.md) | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] | @@ -555,6 +620,72 @@ end - **Accept**: application/json +## list_promotion_tiers + +> list_promotion_tiers(opts) + +List Promotion Tiers + +This method enables you to list promotion tiers. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::PromotionsApi.new +opts = { + is_available: true, # Boolean | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + order: VoucherifySdk::ParameterOrderListPromotionTiers::CREATED_AT # ParameterOrderListPromotionTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +} + +begin + # List Promotion Tiers + result = api_instance.list_promotion_tiers(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling PromotionsApi->list_promotion_tiers: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **is_available** | **Boolean** | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListPromotionTiers**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**PromotionsTiersListResponseBody**](PromotionsTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## list_promotion_tiers_from_campaign > list_promotion_tiers_from_campaign(campaign_id) @@ -676,3 +807,65 @@ end - **Content-Type**: application/json - **Accept**: application/json + +## update_promotion_tier + +> update_promotion_tier(promotion_tier_id, opts) + +Update Promotion Tier + +This method updates a promotion tier. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::PromotionsApi.new +promotion_tier_id = 'promotion_tier_id_example' # String | Unique promotion tier ID. +opts = { + promotions_tiers_update_request_body: VoucherifySdk::PromotionsTiersUpdateRequestBody.new # PromotionsTiersUpdateRequestBody | Specify the promotion tier parameters that you would like to update. +} + +begin + # Update Promotion Tier + result = api_instance.update_promotion_tier(promotion_tier_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling PromotionsApi->update_promotion_tier: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **promotion_tier_id** | **String** | Unique promotion tier ID. | | +| **promotions_tiers_update_request_body** | [**PromotionsTiersUpdateRequestBody**](PromotionsTiersUpdateRequestBody.md) | Specify the promotion tier parameters that you would like to update. | [optional] | + +### Return type + +[**PromotionsTiersUpdateResponseBody**](PromotionsTiersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/PromotionsStacksCreateRequestBody.md b/docs/PromotionsStacksCreateRequestBody.md index 8aae4395..76ee3a3b 100644 --- a/docs/PromotionsStacksCreateRequestBody.md +++ b/docs/PromotionsStacksCreateRequestBody.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Promotion stack name. | | -| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | | +| **name** | **String** | Promotion stack name. | [optional] | +| **tiers** | [**PromotionsStacksCreateRequestBodyTiers**](PromotionsStacksCreateRequestBodyTiers.md) | | [optional] | | **category_id** | **String** | Promotion stack category ID. | [optional] | diff --git a/docs/PromotionsStacksCreateRequestBodyTiers.md b/docs/PromotionsStacksCreateRequestBodyTiers.md new file mode 100644 index 00000000..f8e407c1 --- /dev/null +++ b/docs/PromotionsStacksCreateRequestBodyTiers.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsStacksCreateRequestBodyTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | [optional] | +| **hierarchy_mode** | **String** | | [optional][default to 'MANUAL'] | + diff --git a/docs/PromotionsStacksCreateResponseBody.md b/docs/PromotionsStacksCreateResponseBody.md index 224445ff..78bfb51e 100644 --- a/docs/PromotionsStacksCreateResponseBody.md +++ b/docs/PromotionsStacksCreateResponseBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Promotion stack name. | | -| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | | -| **id** | **String** | Unique promotion stack ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. | | -| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'promotion_stack'] | -| **category_id** | **String** | Promotion stack category ID. | | -| **categories** | [**Array<PromotionStackBase>**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | | +| **name** | **String** | Promotion stack name. | [optional] | +| **tiers** | [**PromotionsStacksCreateResponseBodyTiers**](PromotionsStacksCreateResponseBodyTiers.md) | | [optional] | +| **id** | **String** | Unique promotion stack ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] | +| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'promotion_stack'] | +| **category_id** | **String** | Promotion stack category ID. | [optional] | +| **categories** | [**Array<PromotionStackBase>**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | [optional] | diff --git a/docs/PromotionsStacksCreateResponseBodyTiers.md b/docs/PromotionsStacksCreateResponseBodyTiers.md new file mode 100644 index 00000000..893a7ef7 --- /dev/null +++ b/docs/PromotionsStacksCreateResponseBodyTiers.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsStacksCreateResponseBodyTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | [optional] | +| **hierarchy_mode** | **String** | | [optional][default to 'MANUAL'] | + diff --git a/docs/PromotionsStacksGetResponseBody.md b/docs/PromotionsStacksGetResponseBody.md index 289ade4a..906f2b8f 100644 --- a/docs/PromotionsStacksGetResponseBody.md +++ b/docs/PromotionsStacksGetResponseBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Promotion stack name. | | -| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | | -| **id** | **String** | Unique promotion stack ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format. | [optional] | -| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'promotion_stack'] | -| **category_id** | **String** | Promotion stack category ID. | | -| **categories** | [**Array<Category>**](Category.md) | Details about the category assigned to the promotion stack. | | +| **name** | **String** | Promotion stack name. | [optional] | +| **tiers** | [**PromotionsStacksGetResponseBodyTiers**](PromotionsStacksGetResponseBodyTiers.md) | | [optional] | +| **id** | **String** | Unique promotion stack ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] | +| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'promotion_stack'] | +| **category_id** | **String** | Promotion stack category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Details about the category assigned to the promotion stack. | [optional] | diff --git a/docs/PromotionsStacksGetResponseBodyTiers.md b/docs/PromotionsStacksGetResponseBodyTiers.md new file mode 100644 index 00000000..08626ea2 --- /dev/null +++ b/docs/PromotionsStacksGetResponseBodyTiers.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsStacksGetResponseBodyTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | [optional] | +| **hierarchy_mode** | **String** | | [optional][default to 'MANUAL'] | + diff --git a/docs/PromotionsStacksListResponseBody.md b/docs/PromotionsStacksListResponseBody.md index 9b0b394c..6adf00d4 100644 --- a/docs/PromotionsStacksListResponseBody.md +++ b/docs/PromotionsStacksListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about promotion stacks in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of promotion stack objects. | [default to 'data'] | -| **data** | [**Array<PromotionStack>**](PromotionStack.md) | Contains array of promotion stack objects. | | -| **total** | **Integer** | Total number of promotion stacks. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about promotion stacks in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of promotion stack objects. | [optional][default to 'data'] | +| **data** | [**Array<PromotionStack>**](PromotionStack.md) | Contains array of promotion stack objects. | [optional] | +| **total** | **Integer** | Total number of promotion stacks. | [optional] | diff --git a/docs/PromotionsStacksUpdateResponseBody.md b/docs/PromotionsStacksUpdateResponseBody.md index 662af7a6..e3e4f052 100644 --- a/docs/PromotionsStacksUpdateResponseBody.md +++ b/docs/PromotionsStacksUpdateResponseBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Promotion stack name. | | -| **tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | | -| **id** | **String** | Unique promotion stack ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format. | | -| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'promotion_stack'] | -| **category_id** | **String** | Promotion stack category ID. | | -| **categories** | [**Array<PromotionStackBase>**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | | +| **name** | **String** | Promotion stack name. | [optional] | +| **tiers** | [**PromotionsStacksUpdateResponseBodyTiers**](PromotionsStacksUpdateResponseBodyTiers.md) | | [optional] | +| **id** | **String** | Unique promotion stack ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] | +| **campaign_id** | **String** | Promotion stack's parent campaign's unique ID. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'promotion_stack'] | +| **category_id** | **String** | Promotion stack category ID. | [optional] | +| **categories** | [**Array<PromotionStackBase>**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | [optional] | diff --git a/docs/PromotionsStacksUpdateResponseBodyTiers.md b/docs/PromotionsStacksUpdateResponseBodyTiers.md new file mode 100644 index 00000000..32794a4e --- /dev/null +++ b/docs/PromotionsStacksUpdateResponseBodyTiers.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsStacksUpdateResponseBodyTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **Array<String>** | Contains the list of tiers in a pre-defined sequence. | [optional] | +| **hierarchy_mode** | **String** | | [optional][default to 'MANUAL'] | + diff --git a/docs/PromotionsTiersCreateRequestBody.md b/docs/PromotionsTiersCreateRequestBody.md new file mode 100644 index 00000000..38ee5ec8 --- /dev/null +++ b/docs/PromotionsTiersCreateRequestBody.md @@ -0,0 +1,21 @@ +# VoucherifySdk::PromotionsTiersCreateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**PromotionsTiersCreateRequestBodyAction**](PromotionsTiersCreateRequestBodyAction.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category** | **String** | Assign a new or update the promotion tier's category using name. | [optional] | +| **category_id** | **String** | Assign a new or update the promotion tier's category using id | [optional] | + diff --git a/docs/PromotionsTiersCreateRequestBodyAction.md b/docs/PromotionsTiersCreateRequestBodyAction.md new file mode 100644 index 00000000..21d99c35 --- /dev/null +++ b/docs/PromotionsTiersCreateRequestBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersCreateRequestBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersCreateResponseBody.md b/docs/PromotionsTiersCreateResponseBody.md new file mode 100644 index 00000000..40d1bd06 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBody.md @@ -0,0 +1,29 @@ +# VoucherifySdk::PromotionsTiersCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique promotion tier ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**PromotionsTiersCreateResponseBodyAction**](PromotionsTiersCreateResponseBodyAction.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **promotion_id** | **String** | Promotion unique ID. | [optional] | +| **campaign** | [**PromotionsTiersCreateResponseBodyCampaign**](PromotionsTiersCreateResponseBodyCampaign.md) | | [optional] | +| **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | +| **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**PromotionsTiersCreateResponseBodySummary**](PromotionsTiersCreateResponseBodySummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category_id** | **String** | Promotion tier category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/PromotionsTiersCreateResponseBodyAction.md b/docs/PromotionsTiersCreateResponseBodyAction.md new file mode 100644 index 00000000..db32cff7 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersCreateResponseBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersCreateResponseBodyCampaign.md b/docs/PromotionsTiersCreateResponseBodyCampaign.md new file mode 100644 index 00000000..4b94eb0a --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodyCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::PromotionsTiersCreateResponseBodyCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/PromotionsTiersCreateResponseBodySummary.md b/docs/PromotionsTiersCreateResponseBodySummary.md new file mode 100644 index 00000000..1682bc5c --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodySummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersCreateResponseBodySummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**PromotionsTiersCreateResponseBodySummaryRedemptions**](PromotionsTiersCreateResponseBodySummaryRedemptions.md) | | [optional] | +| **orders** | [**PromotionsTiersCreateResponseBodySummaryOrders**](PromotionsTiersCreateResponseBodySummaryOrders.md) | | [optional] | + diff --git a/docs/PromotionsTiersCreateResponseBodySummaryOrders.md b/docs/PromotionsTiersCreateResponseBodySummaryOrders.md new file mode 100644 index 00000000..102d79df --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodySummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersCreateResponseBodySummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md b/docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..2618c7da --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersCreateResponseBodySummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/PromotionsTiersDisableResponseBody.md b/docs/PromotionsTiersDisableResponseBody.md index 4a5ce620..9dcdaee8 100644 --- a/docs/PromotionsTiersDisableResponseBody.md +++ b/docs/PromotionsTiersDisableResponseBody.md @@ -5,23 +5,24 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique promotion tier ID. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | | **name** | **String** | Name of the promotion tier. | [optional] | | **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | -| **action** | [**PromotionTierAction**](PromotionTierAction.md) | | [optional] | +| **action** | [**PromotionsTiersDisableResponseBodyAction**](PromotionsTiersDisableResponseBodyAction.md) | | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | | **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | | **promotion_id** | **String** | Promotion unique ID. | [optional] | -| **campaign** | [**PromotionTierCampaign**](PromotionTierCampaign.md) | | [optional] | +| **campaign** | [**PromotionsTiersDisableResponseBodyCampaign**](PromotionsTiersDisableResponseBodyCampaign.md) | | [optional] | | **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | | **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | | **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**PromotionTierValidityTimeframe**](PromotionTierValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **summary** | [**PromotionTierSummary**](PromotionTierSummary.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**PromotionsTiersDisableResponseBodySummary**](PromotionsTiersDisableResponseBodySummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | | **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | | **category_id** | **String** | Promotion tier category ID. | [optional] | | **categories** | [**Array<Category>**](Category.md) | | [optional] | diff --git a/docs/PromotionsTiersDisableResponseBodyAction.md b/docs/PromotionsTiersDisableResponseBodyAction.md new file mode 100644 index 00000000..aaf46e75 --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersDisableResponseBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersDisableResponseBodyCampaign.md b/docs/PromotionsTiersDisableResponseBodyCampaign.md new file mode 100644 index 00000000..ea12a780 --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodyCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::PromotionsTiersDisableResponseBodyCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/PromotionsTiersDisableResponseBodySummary.md b/docs/PromotionsTiersDisableResponseBodySummary.md new file mode 100644 index 00000000..660d953f --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodySummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersDisableResponseBodySummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**PromotionsTiersDisableResponseBodySummaryRedemptions**](PromotionsTiersDisableResponseBodySummaryRedemptions.md) | | [optional] | +| **orders** | [**PromotionsTiersDisableResponseBodySummaryOrders**](PromotionsTiersDisableResponseBodySummaryOrders.md) | | [optional] | + diff --git a/docs/PromotionsTiersDisableResponseBodySummaryOrders.md b/docs/PromotionsTiersDisableResponseBodySummaryOrders.md new file mode 100644 index 00000000..6d604443 --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodySummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersDisableResponseBodySummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md b/docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..6d1e698e --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersDisableResponseBodySummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/PromotionsTiersEnableResponseBody.md b/docs/PromotionsTiersEnableResponseBody.md index cdfc1388..3906db3a 100644 --- a/docs/PromotionsTiersEnableResponseBody.md +++ b/docs/PromotionsTiersEnableResponseBody.md @@ -5,23 +5,24 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique promotion tier ID. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | | **name** | **String** | Name of the promotion tier. | [optional] | | **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | -| **action** | [**PromotionTierAction**](PromotionTierAction.md) | | [optional] | +| **action** | [**PromotionsTiersEnableResponseBodyAction**](PromotionsTiersEnableResponseBodyAction.md) | | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | | **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | | **promotion_id** | **String** | Promotion unique ID. | [optional] | -| **campaign** | [**PromotionTierCampaign**](PromotionTierCampaign.md) | | [optional] | +| **campaign** | [**PromotionsTiersEnableResponseBodyCampaign**](PromotionsTiersEnableResponseBodyCampaign.md) | | [optional] | | **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | | **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | | **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**PromotionTierValidityTimeframe**](PromotionTierValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **summary** | [**PromotionTierSummary**](PromotionTierSummary.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**PromotionsTiersEnableResponseBodySummary**](PromotionsTiersEnableResponseBodySummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | | **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | | **category_id** | **String** | Promotion tier category ID. | [optional] | | **categories** | [**Array<Category>**](Category.md) | | [optional] | diff --git a/docs/PromotionsTiersEnableResponseBodyAction.md b/docs/PromotionsTiersEnableResponseBodyAction.md new file mode 100644 index 00000000..b1f025be --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersEnableResponseBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersEnableResponseBodyCampaign.md b/docs/PromotionsTiersEnableResponseBodyCampaign.md new file mode 100644 index 00000000..3e9d48b7 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodyCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::PromotionsTiersEnableResponseBodyCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/PromotionsTiersEnableResponseBodySummary.md b/docs/PromotionsTiersEnableResponseBodySummary.md new file mode 100644 index 00000000..99078334 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodySummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersEnableResponseBodySummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**PromotionsTiersEnableResponseBodySummaryRedemptions**](PromotionsTiersEnableResponseBodySummaryRedemptions.md) | | [optional] | +| **orders** | [**PromotionsTiersEnableResponseBodySummaryOrders**](PromotionsTiersEnableResponseBodySummaryOrders.md) | | [optional] | + diff --git a/docs/PromotionsTiersEnableResponseBodySummaryOrders.md b/docs/PromotionsTiersEnableResponseBodySummaryOrders.md new file mode 100644 index 00000000..02faa7b9 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodySummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersEnableResponseBodySummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md b/docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..11d351d8 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersEnableResponseBodySummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/PromotionsTiersGetResponseBody.md b/docs/PromotionsTiersGetResponseBody.md index b3aee91c..63af07cf 100644 --- a/docs/PromotionsTiersGetResponseBody.md +++ b/docs/PromotionsTiersGetResponseBody.md @@ -5,23 +5,24 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique promotion tier ID. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | | **name** | **String** | Name of the promotion tier. | [optional] | | **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | -| **action** | [**PromotionTierAction**](PromotionTierAction.md) | | [optional] | +| **action** | [**PromotionsTiersGetResponseBodyAction**](PromotionsTiersGetResponseBodyAction.md) | | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | | **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | | **promotion_id** | **String** | Promotion unique ID. | [optional] | -| **campaign** | [**PromotionTierCampaign**](PromotionTierCampaign.md) | | [optional] | +| **campaign** | [**PromotionsTiersGetResponseBodyCampaign**](PromotionsTiersGetResponseBodyCampaign.md) | | [optional] | | **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | | **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | | **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**PromotionTierValidityTimeframe**](PromotionTierValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **summary** | [**PromotionTierSummary**](PromotionTierSummary.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**PromotionsTiersGetResponseBodySummary**](PromotionsTiersGetResponseBodySummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | | **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | | **category_id** | **String** | Promotion tier category ID. | [optional] | | **categories** | [**Array<Category>**](Category.md) | | [optional] | diff --git a/docs/PromotionsTiersGetResponseBodyAction.md b/docs/PromotionsTiersGetResponseBodyAction.md new file mode 100644 index 00000000..470e117f --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersGetResponseBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersGetResponseBodyCampaign.md b/docs/PromotionsTiersGetResponseBodyCampaign.md new file mode 100644 index 00000000..7c66ad78 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodyCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::PromotionsTiersGetResponseBodyCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/PromotionsTiersGetResponseBodySummary.md b/docs/PromotionsTiersGetResponseBodySummary.md new file mode 100644 index 00000000..0886ebdb --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodySummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersGetResponseBodySummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**PromotionsTiersGetResponseBodySummaryRedemptions**](PromotionsTiersGetResponseBodySummaryRedemptions.md) | | [optional] | +| **orders** | [**PromotionsTiersGetResponseBodySummaryOrders**](PromotionsTiersGetResponseBodySummaryOrders.md) | | [optional] | + diff --git a/docs/PromotionsTiersGetResponseBodySummaryOrders.md b/docs/PromotionsTiersGetResponseBodySummaryOrders.md new file mode 100644 index 00000000..0c465c78 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodySummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersGetResponseBodySummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/PromotionsTiersGetResponseBodySummaryRedemptions.md b/docs/PromotionsTiersGetResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..b520e7da --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodySummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersGetResponseBodySummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/PromotionsTiersListResponseBody.md b/docs/PromotionsTiersListResponseBody.md index 560d9fb5..e3ce89f9 100644 --- a/docs/PromotionsTiersListResponseBody.md +++ b/docs/PromotionsTiersListResponseBody.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional][default to 'list'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional][default to 'list'] | | **data_ref** | **String** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional][default to 'tiers'] | | **tiers** | [**Array<PromotionTier>**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] | | **total** | **Integer** | Total number of promotion tiers. | [optional] | -| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | diff --git a/docs/PromotionsTiersUpdateRequestBody.md b/docs/PromotionsTiersUpdateRequestBody.md new file mode 100644 index 00000000..d71cd0d0 --- /dev/null +++ b/docs/PromotionsTiersUpdateRequestBody.md @@ -0,0 +1,20 @@ +# VoucherifySdk::PromotionsTiersUpdateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**PromotionsTiersUpdateRequestBodyAction**](PromotionsTiersUpdateRequestBodyAction.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category** | **String** | Assign a new or update the promotion tier's category using name. | [optional] | +| **category_id** | **String** | Assign a new or update the promotion tier's category using id | [optional] | + diff --git a/docs/PromotionsTiersUpdateRequestBodyAction.md b/docs/PromotionsTiersUpdateRequestBodyAction.md new file mode 100644 index 00000000..e0fa8665 --- /dev/null +++ b/docs/PromotionsTiersUpdateRequestBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersUpdateRequestBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersUpdateResponseBody.md b/docs/PromotionsTiersUpdateResponseBody.md new file mode 100644 index 00000000..4b0f3196 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBody.md @@ -0,0 +1,29 @@ +# VoucherifySdk::PromotionsTiersUpdateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique promotion tier ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**PromotionsTiersUpdateResponseBodyAction**](PromotionsTiersUpdateResponseBodyAction.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **promotion_id** | **String** | Promotion unique ID. | [optional] | +| **campaign** | [**PromotionsTiersUpdateResponseBodyCampaign**](PromotionsTiersUpdateResponseBodyCampaign.md) | | [optional] | +| **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | +| **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**PromotionsTiersUpdateResponseBodySummary**](PromotionsTiersUpdateResponseBodySummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category_id** | **String** | Promotion tier category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/PromotionsTiersUpdateResponseBodyAction.md b/docs/PromotionsTiersUpdateResponseBodyAction.md new file mode 100644 index 00000000..c62e7962 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodyAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersUpdateResponseBodyAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/PromotionsTiersUpdateResponseBodyCampaign.md b/docs/PromotionsTiersUpdateResponseBodyCampaign.md new file mode 100644 index 00000000..486229eb --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodyCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::PromotionsTiersUpdateResponseBodyCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/PromotionsTiersUpdateResponseBodySummary.md b/docs/PromotionsTiersUpdateResponseBodySummary.md new file mode 100644 index 00000000..6656ddcd --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodySummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersUpdateResponseBodySummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**PromotionsTiersUpdateResponseBodySummaryRedemptions**](PromotionsTiersUpdateResponseBodySummaryRedemptions.md) | | [optional] | +| **orders** | [**PromotionsTiersUpdateResponseBodySummaryOrders**](PromotionsTiersUpdateResponseBodySummaryOrders.md) | | [optional] | + diff --git a/docs/PromotionsTiersUpdateResponseBodySummaryOrders.md b/docs/PromotionsTiersUpdateResponseBodySummaryOrders.md new file mode 100644 index 00000000..4a9a06e5 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodySummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::PromotionsTiersUpdateResponseBodySummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md b/docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..3d72532d --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::PromotionsTiersUpdateResponseBodySummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/PropertiesForLoyaltyCampaignOptions.md b/docs/PropertiesForLoyaltyCampaignOptions.md deleted file mode 100644 index dfe27fed..00000000 --- a/docs/PropertiesForLoyaltyCampaignOptions.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::PropertiesForLoyaltyCampaignOptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **recalculate_tiers** | **Boolean** | Determine if tiers should be recalculated or no. | [optional] | - diff --git a/docs/PublicationsApi.md b/docs/PublicationsApi.md index 1a5ca8bd..6af74ae7 100644 --- a/docs/PublicationsApi.md +++ b/docs/PublicationsApi.md @@ -38,7 +38,7 @@ end api_instance = VoucherifySdk::PublicationsApi.new opts = { join_once: true, # Boolean | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. - publications_create_request_body: VoucherifySdk::CreatePublicationWithCampaign.new({customer: VoucherifySdk::Customer.new, campaign: VoucherifySdk::CreatePublicationCampaign.new({name: 'camp_dphuwqH7BOVkgh4JmpDtS32l'})}) # PublicationsCreateRequestBody | Specify the publication parameters. + publications_create_request_body: VoucherifySdk::PublicationsCreateRequestBody.new # PublicationsCreateRequestBody | Specify the publication parameters. } begin @@ -102,8 +102,8 @@ customer = VoucherifySdk::Customer.new # Customer | Contains information about t opts = { join_once: true, # Boolean | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. voucher: 'voucher_example', # String | Code of voucher being published. - campaign: VoucherifySdk::CreatePublicationCampaign.new({name: 'camp_dphuwqH7BOVkgh4JmpDtS32l'}), # CreatePublicationCampaign | Create publication with campaign. - source_id: 'source_id_example', # String | The merchant’s publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. + campaign: VoucherifySdk::CreatePublicationCampaign.new, # CreatePublicationCampaign | Create publication with campaign. + source_id: 'source_id_example', # String | The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. metadata: { key: 3.56} # Object | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. } @@ -124,7 +124,7 @@ end | **join_once** | **Boolean** | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. | [optional] | | **voucher** | **String** | Code of voucher being published. | [optional] | | **campaign** | [**CreatePublicationCampaign**](.md) | Create publication with campaign. | [optional] | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. | [optional] | +| **source_id** | **String** | The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. | [optional] | | **metadata** | [**Object**](.md) | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] | ### Return type @@ -169,8 +169,8 @@ end api_instance = VoucherifySdk::PublicationsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrderListPublications::ID, # ParameterOrderListPublications | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. campaign: 'campaign_example', # String | Filters by a given campaign name. customer: 'customer_example', # String | Filters by a unique customer ID. @@ -195,8 +195,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrderListPublications**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | | **campaign** | **String** | Filters by a given campaign name. | [optional] | | **customer** | **String** | Filters by a unique customer ID. | [optional] | diff --git a/docs/PublicationsCreateBaseResponseBody.md b/docs/PublicationsCreateBaseResponseBody.md deleted file mode 100644 index a69ef685..00000000 --- a/docs/PublicationsCreateBaseResponseBody.md +++ /dev/null @@ -1,18 +0,0 @@ -# VoucherifySdk::PublicationsCreateBaseResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | [default to 'API'] | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **result** | **String** | Status of the publication attempt. | [default to 'SUCCESS'] | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | - diff --git a/docs/PublicationsCreateRequestBody.md b/docs/PublicationsCreateRequestBody.md index 911a83ad..0f55ee85 100644 --- a/docs/PublicationsCreateRequestBody.md +++ b/docs/PublicationsCreateRequestBody.md @@ -1,49 +1,13 @@ # VoucherifySdk::PublicationsCreateRequestBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::PublicationsCreateRequestBody.openapi_one_of -# => -# [ -# :'CreatePublicationWithCampaign', -# :'CreatePublicationWithSpecificVoucher' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::PublicationsCreateRequestBody.build(data) -# => # - -VoucherifySdk::PublicationsCreateRequestBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `CreatePublicationWithCampaign` -- `CreatePublicationWithSpecificVoucher` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **voucher** | **String** | Code of the voucher being published. | [optional] | +| **source_id** | **String** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] | +| **customer** | [**PublicationsCreateRequestBodyCustomer**](PublicationsCreateRequestBodyCustomer.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **channel** | **String** | Specify the distribution channel. | [optional] | +| **campaign** | [**CreatePublicationCampaign**](CreatePublicationCampaign.md) | | [optional] | diff --git a/docs/PublicationsCreateRequestBodyCustomer.md b/docs/PublicationsCreateRequestBodyCustomer.md new file mode 100644 index 00000000..527d5901 --- /dev/null +++ b/docs/PublicationsCreateRequestBodyCustomer.md @@ -0,0 +1,17 @@ +# VoucherifySdk::PublicationsCreateRequestBodyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The ID of an existing customer. | [optional] | +| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | +| **name** | **String** | Customer's first and last name. | [optional] | +| **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | +| **email** | **String** | Customer's email address. | [optional] | +| **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | +| **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **address** | [**PublicationsCreateRequestBodyCustomerAddress**](PublicationsCreateRequestBodyCustomerAddress.md) | | [optional] | +| **metadata** | **Object** | | [optional] | + diff --git a/docs/PublicationsCreateRequestBodyCustomerAddress.md b/docs/PublicationsCreateRequestBodyCustomerAddress.md new file mode 100644 index 00000000..bc36f7bc --- /dev/null +++ b/docs/PublicationsCreateRequestBodyCustomerAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::PublicationsCreateRequestBodyCustomerAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/PublicationsCreateResponseBody.md b/docs/PublicationsCreateResponseBody.md index 4e92d30a..d63901e0 100644 --- a/docs/PublicationsCreateResponseBody.md +++ b/docs/PublicationsCreateResponseBody.md @@ -1,49 +1,20 @@ # VoucherifySdk::PublicationsCreateResponseBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::PublicationsCreateResponseBody.openapi_one_of -# => -# [ -# :'PublicationsCreateVoucherResponseBody', -# :'PublicationsCreateVouchersResponseBody' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::PublicationsCreateResponseBody.build(data) -# => # - -VoucherifySdk::PublicationsCreateResponseBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `PublicationsCreateVoucherResponseBody` -- `PublicationsCreateVouchersResponseBody` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique publication ID, assigned by Voucherify. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the `publication`. | [optional][default to 'publication'] | +| **created_at** | **Time** | Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | [optional] | +| **tracking_id** | **String** | Customer's `source_id`. | [optional] | +| **metadata** | **Object** | | [optional] | +| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | [optional][default to 'API'] | +| **source_id** | **String** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | [optional] | +| **result** | **String** | Status of the publication attempt. | [optional][default to 'SUCCESS'] | +| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] | +| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | [optional] | +| **voucher** | [**Voucher**](Voucher.md) | | [optional] | +| **vouchers** | **Array<String>** | Contains the unique voucher codes that was assigned by Voucherify. | [optional] | diff --git a/docs/PublicationsCreateVoucherResponseBody.md b/docs/PublicationsCreateVoucherResponseBody.md deleted file mode 100644 index 52e0f14f..00000000 --- a/docs/PublicationsCreateVoucherResponseBody.md +++ /dev/null @@ -1,19 +0,0 @@ -# VoucherifySdk::PublicationsCreateVoucherResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | [default to 'API'] | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **result** | **String** | Status of the publication attempt. | [default to 'SUCCESS'] | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | -| **voucher** | [**Voucher**](Voucher.md) | | | - diff --git a/docs/PublicationsCreateVouchersResponseBody.md b/docs/PublicationsCreateVouchersResponseBody.md deleted file mode 100644 index 0496a955..00000000 --- a/docs/PublicationsCreateVouchersResponseBody.md +++ /dev/null @@ -1,19 +0,0 @@ -# VoucherifySdk::PublicationsCreateVouchersResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique publication ID, assigned by Voucherify. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `publication`. | [default to 'publication'] | -| **created_at** | **Time** | Timestamp representing the date and time when the publication was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | | -| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | [default to 'API'] | -| **source_id** | **String** | The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | | -| **result** | **String** | Status of the publication attempt. | [default to 'SUCCESS'] | -| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | | -| **vouchers_id** | **Array<String>** | Contains the unique internal voucher ID that was assigned by Voucherify. | | -| **vouchers** | **Array<String>** | Contains the unique voucher codes that was assigned by Voucherify. | | - diff --git a/docs/PublicationsListResponseBody.md b/docs/PublicationsListResponseBody.md index 72b2e50e..66e26487 100644 --- a/docs/PublicationsListResponseBody.md +++ b/docs/PublicationsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about publications in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of publications. | [default to 'publications'] | -| **publications** | [**Array<PublicationsListResponseBodyPublicationsItem>**](PublicationsListResponseBodyPublicationsItem.md) | Contains array of publication objects, voucher object will be simplified. | | -| **total** | **Integer** | Total number of publications. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about publications in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of publications. | [optional][default to 'publications'] | +| **publications** | [**Array<PublicationsListResponseBodyPublicationsItem>**](PublicationsListResponseBodyPublicationsItem.md) | Response schema model for publishing vouchers to a specific customer. | [optional] | +| **total** | **Integer** | Total number of publications. | [optional] | diff --git a/docs/PublicationsListResponseBodyPublicationsItem.md b/docs/PublicationsListResponseBodyPublicationsItem.md index 174a2e4e..ab6c33b8 100644 --- a/docs/PublicationsListResponseBodyPublicationsItem.md +++ b/docs/PublicationsListResponseBodyPublicationsItem.md @@ -1,51 +1,22 @@ # VoucherifySdk::PublicationsListResponseBodyPublicationsItem -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::PublicationsListResponseBodyPublicationsItem.openapi_one_of -# => -# [ -# :'ListPublicationsItemInvalid', -# :'ListPublicationsItemValidMultipleVouchers', -# :'ListPublicationsItemValidSingleVoucher' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::PublicationsListResponseBodyPublicationsItem.build(data) -# => # - -VoucherifySdk::PublicationsListResponseBodyPublicationsItem.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ListPublicationsItemInvalid` -- `ListPublicationsItemValidMultipleVouchers` -- `ListPublicationsItemValidSingleVoucher` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique publication ID, assigned by Voucherify. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the `publication`. | [optional][default to 'publication'] | +| **created_at** | **Time** | Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer receiving the publication. | [optional] | +| **tracking_id** | **String** | Customer's `source_id`. | [optional] | +| **metadata** | [**PublicationsListResponseBodyPublicationsItemMetadata**](PublicationsListResponseBodyPublicationsItemMetadata.md) | | [optional] | +| **channel** | **String** | How the publication was originated. It can be your own custom channel or an example value provided here. | [optional] | +| **source_id** | **String** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | [optional] | +| **customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] | +| **vouchers** | **Array<String>** | Contains the voucher IDs that was assigned by Voucherify. and Contains the unique voucher codes that was assigned by Voucherify. | [optional] | +| **vouchers_id** | **Array<String>** | Contains the unique internal voucher IDs that was assigned by Voucherify. | [optional] | +| **result** | **String** | | [optional] | +| **voucher** | [**ListPublicationsItemVoucher**](ListPublicationsItemVoucher.md) | | [optional] | +| **failure_code** | **String** | Generic reason as to why the create publication operation failed. | [optional] | +| **failure_message** | **String** | This parameter will provide more expanded reason as to why the create publication operation failed. | [optional] | diff --git a/docs/PublicationsListResponseBodyPublicationsItemMetadata.md b/docs/PublicationsListResponseBodyPublicationsItemMetadata.md new file mode 100644 index 00000000..f56bf318 --- /dev/null +++ b/docs/PublicationsListResponseBodyPublicationsItemMetadata.md @@ -0,0 +1,10 @@ +# VoucherifySdk::PublicationsListResponseBodyPublicationsItemMetadata + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **source_type** | **String** | Defines the type of the distribution source. | [optional] | +| **source_id** | **String** | Unique identifier of the distribution source. | [optional] | +| **distribution_id** | **String** | Unique identifier of the distribution. | [optional] | + diff --git a/docs/QualificationsApi.md b/docs/QualificationsApi.md index aab8a9aa..98233787 100644 --- a/docs/QualificationsApi.md +++ b/docs/QualificationsApi.md @@ -13,7 +13,7 @@ All URIs are relative to *https://api.voucherify.io* Check Eligibility - 🚧 The Qualifications endpoint in the basic mode ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + 🚧 The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. ### Examples diff --git a/docs/QualificationsCheckEligibilityRequestBody.md b/docs/QualificationsCheckEligibilityRequestBody.md index 1fb6dc57..d0b291a3 100644 --- a/docs/QualificationsCheckEligibilityRequestBody.md +++ b/docs/QualificationsCheckEligibilityRequestBody.md @@ -6,9 +6,8 @@ | ---- | ---- | ----------- | ----- | | **customer** | [**Customer**](Customer.md) | | [optional] | | **order** | [**Order**](Order.md) | | [optional] | -| **mode** | **String** | Defines which resources Voucherify will use. The `ADVANCED` mode is available after purchase only. | [optional] | | **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | -| **scenario** | **String** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] | +| **scenario** | **String** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] | | **options** | [**QualificationsOption**](QualificationsOption.md) | | [optional] | | **metadata** | **Object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] | diff --git a/docs/QualificationsFiltersCondition.md b/docs/QualificationsFiltersCondition.md index e4a15897..9e13e50c 100644 --- a/docs/QualificationsFiltersCondition.md +++ b/docs/QualificationsFiltersCondition.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **is** | [**Any**](Any.md) | | [optional] | -| **is_not** | [**Any**](Any.md) | | [optional] | -| **has_value** | [**Any**](Any.md) | | [optional] | -| **is_unknown** | [**Any**](Any.md) | | [optional] | -| **_in** | [**Any**](Any.md) | | [optional] | -| **not_in** | [**Any**](Any.md) | | [optional] | +| **is** | **Array<String>** | | [optional] | +| **is_not** | **Array<String>** | | [optional] | +| **has_value** | **Object** | | [optional] | +| **is_unknown** | **Object** | | [optional] | +| **_in** | **Array<String>** | | [optional] | +| **not_in** | **Array<String>** | | [optional] | diff --git a/docs/QualificationsOptionFilters.md b/docs/QualificationsOptionFilters.md index 374377d2..9b683845 100644 --- a/docs/QualificationsOptionFilters.md +++ b/docs/QualificationsOptionFilters.md @@ -7,8 +7,10 @@ | **junction** | [**Junction**](Junction.md) | | [optional] | | **category_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | | **campaign_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | +| **campaign_type** | [**QualificationsOptionFiltersCampaignType**](QualificationsOptionFiltersCampaignType.md) | | [optional] | | **resource_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | | **resource_type** | [**QualificationsOptionFiltersResourceType**](QualificationsOptionFiltersResourceType.md) | | [optional] | | **voucher_type** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | | **code** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] | +| **holder_role** | [**QualificationsOptionFiltersHolderRole**](QualificationsOptionFiltersHolderRole.md) | | [optional] | diff --git a/docs/QualificationsOptionFiltersCampaignType.md b/docs/QualificationsOptionFiltersCampaignType.md new file mode 100644 index 00000000..9889ce01 --- /dev/null +++ b/docs/QualificationsOptionFiltersCampaignType.md @@ -0,0 +1,8 @@ +# VoucherifySdk::QualificationsOptionFiltersCampaignType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**QualificationsOptionFiltersCampaignTypeConditions**](QualificationsOptionFiltersCampaignTypeConditions.md) | | [optional] | + diff --git a/docs/QualificationsOptionFiltersCampaignTypeConditions.md b/docs/QualificationsOptionFiltersCampaignTypeConditions.md new file mode 100644 index 00000000..07b39e74 --- /dev/null +++ b/docs/QualificationsOptionFiltersCampaignTypeConditions.md @@ -0,0 +1,11 @@ +# VoucherifySdk::QualificationsOptionFiltersCampaignTypeConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **is** | [**Array<ParameterCampaignType>**](ParameterCampaignType.md) | | [optional] | +| **is_not** | [**Array<ParameterCampaignType>**](ParameterCampaignType.md) | | [optional] | +| **_in** | [**Array<ParameterCampaignType>**](ParameterCampaignType.md) | | [optional] | +| **not_in** | [**Array<ParameterCampaignType>**](ParameterCampaignType.md) | | [optional] | + diff --git a/docs/QualificationsOptionFiltersHolderRole.md b/docs/QualificationsOptionFiltersHolderRole.md new file mode 100644 index 00000000..fb2bb6d3 --- /dev/null +++ b/docs/QualificationsOptionFiltersHolderRole.md @@ -0,0 +1,8 @@ +# VoucherifySdk::QualificationsOptionFiltersHolderRole + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **conditions** | [**QualificationsOptionFiltersHolderRoleConditions**](QualificationsOptionFiltersHolderRoleConditions.md) | | [optional] | + diff --git a/docs/QualificationsOptionFiltersHolderRoleConditions.md b/docs/QualificationsOptionFiltersHolderRoleConditions.md new file mode 100644 index 00000000..942a4b98 --- /dev/null +++ b/docs/QualificationsOptionFiltersHolderRoleConditions.md @@ -0,0 +1,11 @@ +# VoucherifySdk::QualificationsOptionFiltersHolderRoleConditions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **is** | **Array<String>** | Will return records only for the first value in the array. | [optional] | +| **is_not** | **Array<String>** | Will return records only for the first value in the array. | [optional] | +| **_in** | **Array<String>** | Will return records for the values in the array. | [optional] | +| **not_in** | **Array<String>** | Will return records for the values in the array. | [optional] | + diff --git a/docs/QualificationsOptionFiltersResourceTypeConditions.md b/docs/QualificationsOptionFiltersResourceTypeConditions.md index e9506a9f..2adffa60 100644 --- a/docs/QualificationsOptionFiltersResourceTypeConditions.md +++ b/docs/QualificationsOptionFiltersResourceTypeConditions.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **is** | [**ResourceTypes**](ResourceTypes.md) | | [optional] | -| **is_not** | [**ResourceTypes**](ResourceTypes.md) | | [optional] | -| **_in** | [**Array<ResourceTypes>**](ResourceTypes.md) | Array of qualified redeemables. Accepts more than one value. Returns the resource types entered in the array. | [optional] | -| **not_in** | [**Array<ResourceTypes>**](ResourceTypes.md) | Array of qualified redeemables. Accepts more than one value. Returns the resource types except those entered in the array. | [optional] | +| **is** | [**Array<ResourceTypes>**](ResourceTypes.md) | | [optional] | +| **is_not** | [**Array<ResourceTypes>**](ResourceTypes.md) | | [optional] | +| **_in** | [**Array<ResourceTypes>**](ResourceTypes.md) | | [optional] | +| **not_in** | [**Array<ResourceTypes>**](ResourceTypes.md) | | [optional] | diff --git a/docs/QualificationsRedeemable.md b/docs/QualificationsRedeemable.md index 2db0724f..7d89f817 100644 --- a/docs/QualificationsRedeemable.md +++ b/docs/QualificationsRedeemable.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | Id of the redeemable. | [optional] | | **object** | **String** | Object type of the redeemable. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | | **result** | [**RedeemableResult**](RedeemableResult.md) | | [optional] | | **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | | **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | diff --git a/docs/QualificationsRedeemableBase.md b/docs/QualificationsRedeemableBase.md index ed69dd29..64d9514e 100644 --- a/docs/QualificationsRedeemableBase.md +++ b/docs/QualificationsRedeemableBase.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | Id of the redeemable. | [optional] | | **object** | **String** | Object type of the redeemable. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | | **result** | [**RedeemableResult**](RedeemableResult.md) | | [optional] | | **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | | **validation_rule_id** | **String** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] | diff --git a/docs/QualificationsRedeemables.md b/docs/QualificationsRedeemables.md index e40a5a49..5d2e55f5 100644 --- a/docs/QualificationsRedeemables.md +++ b/docs/QualificationsRedeemables.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. Default is `list`. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of qualified redeemables. | [default to 'data'] | -| **data** | [**Array<QualificationsRedeemable>**](QualificationsRedeemable.md) | Array of qualified redeemables. | | -| **total** | **Integer** | The number of redeemables returned in the API request. | | -| **has_more** | **Boolean** | As results are always limited, the `has_more` flag indicates whether there are more records for given parameters. This let's you know if you are able to run another request (with different options) to get more records returned in the results. | | -| **more_starting_after** | **Time** | Timestamp representing the date and time to use in starting_after cursor to get more redeemables. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `list`. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of qualified redeemables. | [optional][default to 'data'] | +| **data** | [**Array<QualificationsRedeemable>**](QualificationsRedeemable.md) | Array of qualified redeemables. | [optional] | +| **total** | **Integer** | The number of redeemables returned in the API request. | [optional] | +| **has_more** | **Boolean** | As results are always limited, the `has_more` flag indicates if there are more records for given parameters. This lets you know if you can run another request (with different options) to get more records returned in the results. | [optional] | +| **more_starting_after** | **Time** | Timestamp representing the date and time to use in `starting_after` cursor to get more redeemables. | [optional] | diff --git a/docs/QualificationsStackingRules.md b/docs/QualificationsStackingRules.md deleted file mode 100644 index b9eccdf6..00000000 --- a/docs/QualificationsStackingRules.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::QualificationsStackingRules - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **redeemables_limit** | **Integer** | Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!). | [default to 30] | -| **applicable_redeemables_limit** | **Integer** | Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. | [default to 5] | -| **applicable_exclusive_redeemables_limit** | **Integer** | Defines how many redeemables with an exclusive category can be applied in one request. | [default to 1] | -| **exclusive_categories** | **Array<String>** | Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. | | -| **joint_categories** | **Array<String>** | Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns. | | - diff --git a/docs/RedeemGiftCard.md b/docs/RedeemGiftCard.md deleted file mode 100644 index 422721a5..00000000 --- a/docs/RedeemGiftCard.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::RedeemGiftCard - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | Redeemable object type. | [default to 'voucher'] | -| **id** | **String** | Redeemable code. | | -| **gift** | [**RedeemGiftCardAllOfGift**](RedeemGiftCardAllOfGift.md) | | [optional] | - diff --git a/docs/RedeemGiftCardAllOfGift.md b/docs/RedeemGiftCardAllOfGift.md deleted file mode 100644 index f7222d9e..00000000 --- a/docs/RedeemGiftCardAllOfGift.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemGiftCardAllOfGift - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **credits** | **Integer** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | - diff --git a/docs/RedeemLoyaltyCard.md b/docs/RedeemLoyaltyCard.md deleted file mode 100644 index 6b670a93..00000000 --- a/docs/RedeemLoyaltyCard.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::RedeemLoyaltyCard - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | Redeemable object type. | [default to 'voucher'] | -| **id** | **String** | Redeemable code. | | -| **reward** | [**RedeemLoyaltyCardAllOfReward**](RedeemLoyaltyCardAllOfReward.md) | | [optional] | - diff --git a/docs/RedeemLoyaltyCardAllOfReward.md b/docs/RedeemLoyaltyCardAllOfReward.md deleted file mode 100644 index 597f7978..00000000 --- a/docs/RedeemLoyaltyCardAllOfReward.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedeemLoyaltyCardAllOfReward - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] | -| **points** | **Integer** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] | - diff --git a/docs/RedeemPromotionStack.md b/docs/RedeemPromotionStack.md deleted file mode 100644 index 38e129fe..00000000 --- a/docs/RedeemPromotionStack.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedeemPromotionStack - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | Redeemable object type. | [default to 'promotion_stack'] | -| **id** | **String** | Promotion stack unique id, such as: stack_KxSD0GahLUg9ULB6TseGfUHJ | | - diff --git a/docs/RedeemPromotionTier.md b/docs/RedeemPromotionTier.md deleted file mode 100644 index 0d635766..00000000 --- a/docs/RedeemPromotionTier.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedeemPromotionTier - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | Redeemable object type. | [default to 'promotion_tier'] | -| **id** | **String** | Promotion tier unique id, such as: promo_Mwy9XpA0TLctSGriM5kum0qp | | - diff --git a/docs/RedeemVoucher.md b/docs/RedeemVoucher.md deleted file mode 100644 index fade8ec4..00000000 --- a/docs/RedeemVoucher.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedeemVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | Redeemable object type. | [default to 'voucher'] | -| **id** | **String** | Redeemable code. | | - diff --git a/docs/RedeemableLoyaltyCard.md b/docs/RedeemableLoyaltyCard.md index 7e3812c0..6d826c28 100644 --- a/docs/RedeemableLoyaltyCard.md +++ b/docs/RedeemableLoyaltyCard.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Total points incurred over lifespan of loyalty card. | [optional] | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | | **balance** | **Integer** | Points available for reward redemption. | [optional] | | **exchange_ratio** | **Float** | The cash equivalent of the points defined in the points_ratio property. | [optional] | | **points_ratio** | **Integer** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] | diff --git a/docs/RedeemableResultGiftCard.md b/docs/RedeemableResultGiftCard.md deleted file mode 100644 index cb391500..00000000 --- a/docs/RedeemableResultGiftCard.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultGiftCard - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **gift** | [**RedeemableResultGiftCardGift**](RedeemableResultGiftCardGift.md) | | [optional] | - diff --git a/docs/RedeemableResultGiftCardGift.md b/docs/RedeemableResultGiftCardGift.md deleted file mode 100644 index c374b431..00000000 --- a/docs/RedeemableResultGiftCardGift.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultGiftCardGift - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **credits** | **Integer** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | - diff --git a/docs/RedeemableResultLoyaltyCard.md b/docs/RedeemableResultLoyaltyCard.md deleted file mode 100644 index cf44c3e8..00000000 --- a/docs/RedeemableResultLoyaltyCard.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultLoyaltyCard - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **loyalty_card** | [**RedeemableResultLoyaltyCardLoyaltyCard**](RedeemableResultLoyaltyCardLoyaltyCard.md) | | [optional] | - diff --git a/docs/RedeemableResultLoyaltyCardLoyaltyCard.md b/docs/RedeemableResultLoyaltyCardLoyaltyCard.md deleted file mode 100644 index 921179cf..00000000 --- a/docs/RedeemableResultLoyaltyCardLoyaltyCard.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultLoyaltyCardLoyaltyCard - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Total number of loyalty points to be applied in the redemption. | [optional] | - diff --git a/docs/RedeemableResultPromotionStack.md b/docs/RedeemableResultPromotionStack.md deleted file mode 100644 index 7fbaa728..00000000 --- a/docs/RedeemableResultPromotionStack.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultPromotionStack - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **loyalty_card** | [**RedeemableResultLoyaltyCardLoyaltyCard**](RedeemableResultLoyaltyCardLoyaltyCard.md) | | [optional] | - diff --git a/docs/RedeemableResultPromotionTier.md b/docs/RedeemableResultPromotionTier.md deleted file mode 100644 index 0bafe2e0..00000000 --- a/docs/RedeemableResultPromotionTier.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultPromotionTier - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **discount** | [**RedeemableResultPromotionTierDiscount**](RedeemableResultPromotionTierDiscount.md) | | [optional] | - diff --git a/docs/RedeemableResultPromotionTierDiscount.md b/docs/RedeemableResultPromotionTierDiscount.md deleted file mode 100644 index 3241653c..00000000 --- a/docs/RedeemableResultPromotionTierDiscount.md +++ /dev/null @@ -1,55 +0,0 @@ -# VoucherifySdk::RedeemableResultPromotionTierDiscount - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RedeemableResultPromotionTierDiscount.openapi_one_of -# => -# [ -# :'DiscountAmount', -# :'DiscountFixed', -# :'DiscountPercent', -# :'DiscountUnit', -# :'DiscountUnitMultiple' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RedeemableResultPromotionTierDiscount.build(data) -# => # - -VoucherifySdk::RedeemableResultPromotionTierDiscount.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `DiscountAmount` -- `DiscountFixed` -- `DiscountPercent` -- `DiscountUnit` -- `DiscountUnitMultiple` -- `nil` (if no type matches) - diff --git a/docs/RedeemableResultVoucherCode.md b/docs/RedeemableResultVoucherCode.md deleted file mode 100644 index f1051972..00000000 --- a/docs/RedeemableResultVoucherCode.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RedeemableResultVoucherCode - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **discount** | [**RedeemableResultPromotionTierDiscount**](RedeemableResultPromotionTierDiscount.md) | | [optional] | - diff --git a/docs/RedeemableVoucher.md b/docs/RedeemableVoucher.md new file mode 100644 index 00000000..e4f226e8 --- /dev/null +++ b/docs/RedeemableVoucher.md @@ -0,0 +1,35 @@ +# VoucherifySdk::RedeemableVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | The value is null. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **categories** | **Array<Object>** | Contains an empty array. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**RedeemableVoucherGift**](RedeemableVoucherGift.md) | | [optional] | +| **loyalty_card** | [**RedeemableVoucherLoyaltyCard**](RedeemableVoucherLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**RedeemableVoucherPublish**](RedeemableVoucherPublish.md) | | [optional] | +| **redemption** | [**RedeemableVoucherRedemption**](RedeemableVoucherRedemption.md) | | [optional] | + diff --git a/docs/RedeemableVoucherGift.md b/docs/RedeemableVoucherGift.md new file mode 100644 index 00000000..764a6f4b --- /dev/null +++ b/docs/RedeemableVoucherGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedeemableVoucherGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/RedeemableVoucherLoyaltyCard.md b/docs/RedeemableVoucherLoyaltyCard.md new file mode 100644 index 00000000..b6559348 --- /dev/null +++ b/docs/RedeemableVoucherLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RedeemableVoucherLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/RedeemableVoucherPublish.md b/docs/RedeemableVoucherPublish.md new file mode 100644 index 00000000..7e66c791 --- /dev/null +++ b/docs/RedeemableVoucherPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedeemableVoucherPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/RedeemableVoucherRedemption.md b/docs/RedeemableVoucherRedemption.md new file mode 100644 index 00000000..82cdc510 --- /dev/null +++ b/docs/RedeemableVoucherRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RedeemableVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/Redemption.md b/docs/Redemption.md index d1e02866..7ef4fe21 100644 --- a/docs/Redemption.md +++ b/docs/Redemption.md @@ -4,25 +4,25 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | | -| **object** | **String** | The type of object represented by the JSON | [default to 'redemption'] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the redeeming customer. | | -| **tracking_id** | **String** | Hashed customer source ID. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **redemption** | **String** | Unique redemption ID of the parent redemption. | | -| **result** | **String** | Redemption result. | | -| **status** | **String** | Redemption status. | | +| **id** | **String** | Unique redemption ID. | [optional] | +| **object** | **String** | The type of the object represented by the JSON | [optional][default to 'redemption'] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] | +| **amount** | **Integer** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | Redemption status. | [optional] | | **related_redemptions** | [**RedemptionRelatedRedemptions**](RedemptionRelatedRedemptions.md) | | [optional] | | **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | | **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | -| **order** | [**OrderCalculatedNoCustomerData**](OrderCalculatedNoCustomerData.md) | | | -| **channel** | [**RedemptionChannel**](RedemptionChannel.md) | | | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | | -| **related_object_type** | **String** | Defines the related object. | | -| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | | -| **voucher** | [**Voucher**](Voucher.md) | | [optional] | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | +| **channel** | [**RedemptionChannel**](RedemptionChannel.md) | | [optional] | +| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] | +| **voucher** | [**RedemptionVoucher**](RedemptionVoucher.md) | | [optional] | | **promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] | | **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | | **gift** | [**RedemptionGift**](RedemptionGift.md) | | [optional] | diff --git a/docs/RedemptionEntry.md b/docs/RedemptionEntry.md new file mode 100644 index 00000000..21db4060 --- /dev/null +++ b/docs/RedemptionEntry.md @@ -0,0 +1,31 @@ +# VoucherifySdk::RedemptionEntry + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | | [optional] | +| **amount** | **Integer** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | | [optional] | +| **related_redemptions** | [**RedemptionEntryRelatedRedemptions**](RedemptionEntryRelatedRedemptions.md) | | [optional] | +| **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | +| **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | +| **order** | [**RedemptionEntryOrder**](RedemptionEntryOrder.md) | | [optional] | +| **channel** | [**RedemptionEntryChannel**](RedemptionEntryChannel.md) | | [optional] | +| **customer** | [**RedemptionEntryCustomer**](RedemptionEntryCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | | [optional] | +| **voucher** | [**RedemptionEntryVoucher**](RedemptionEntryVoucher.md) | | [optional] | +| **promotion_tier** | [**RedemptionEntryPromotionTier**](RedemptionEntryPromotionTier.md) | | [optional] | +| **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | +| **gift** | [**RedemptionEntryGift**](RedemptionEntryGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionEntryLoyaltyCard**](RedemptionEntryLoyaltyCard.md) | | [optional] | +| **reason** | **String** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] | + diff --git a/docs/RedemptionEntryChannel.md b/docs/RedemptionEntryChannel.md new file mode 100644 index 00000000..063ae2c7 --- /dev/null +++ b/docs/RedemptionEntryChannel.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **channel_id** | **String** | | [optional] | +| **channel_type** | **String** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | + diff --git a/docs/RedemptionEntryCustomer.md b/docs/RedemptionEntryCustomer.md new file mode 100644 index 00000000..24bc1259 --- /dev/null +++ b/docs/RedemptionEntryCustomer.md @@ -0,0 +1,13 @@ +# VoucherifySdk::RedemptionEntryCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] | +| **name** | **String** | Customer's first and last name. | [optional] | +| **email** | **String** | Customer's email address. | [optional] | +| **source_id** | **String** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] | +| **metadata** | **Object** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionEntryGift.md b/docs/RedemptionEntryGift.md new file mode 100644 index 00000000..bd7f69ee --- /dev/null +++ b/docs/RedemptionEntryGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionEntryGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] | + diff --git a/docs/RedemptionEntryLoyaltyCard.md b/docs/RedemptionEntryLoyaltyCard.md new file mode 100644 index 00000000..d76aaf9c --- /dev/null +++ b/docs/RedemptionEntryLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionEntryLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] | + diff --git a/docs/RedemptionEntryOrder.md b/docs/RedemptionEntryOrder.md new file mode 100644 index 00000000..f0437161 --- /dev/null +++ b/docs/RedemptionEntryOrder.md @@ -0,0 +1,29 @@ +# VoucherifySdk::RedemptionEntryOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | +| **status** | **String** | The order status. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **items_discount_amount** | **Integer** | Sum of all product-specific discounts applied to the order. | [optional] | +| **total_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] | +| **total_amount** | **Integer** | Order amount after undoing all the discounts through the rollback redemption. | [optional] | +| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | +| **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | +| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | +| **metadata** | **Object** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | +| **customer** | [**RedemptionEntryOrderCustomer**](RedemptionEntryOrderCustomer.md) | | [optional] | +| **referrer** | [**RedemptionEntryOrderReferrer**](RedemptionEntryOrderReferrer.md) | | [optional] | +| **redemptions** | **Object** | | [optional] | + diff --git a/docs/RedemptionEntryOrderCustomer.md b/docs/RedemptionEntryOrderCustomer.md new file mode 100644 index 00000000..5ffc1a01 --- /dev/null +++ b/docs/RedemptionEntryOrderCustomer.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryOrderCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionEntryOrderReferrer.md b/docs/RedemptionEntryOrderReferrer.md new file mode 100644 index 00000000..4cd1aade --- /dev/null +++ b/docs/RedemptionEntryOrderReferrer.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryOrderReferrer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionEntryPromotionTier.md b/docs/RedemptionEntryPromotionTier.md new file mode 100644 index 00000000..16e8ba34 --- /dev/null +++ b/docs/RedemptionEntryPromotionTier.md @@ -0,0 +1,29 @@ +# VoucherifySdk::RedemptionEntryPromotionTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique promotion tier ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**RedemptionEntryPromotionTierAction**](RedemptionEntryPromotionTierAction.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **promotion_id** | **String** | Promotion unique ID. | [optional] | +| **campaign** | [**RedemptionEntryPromotionTierCampaign**](RedemptionEntryPromotionTierCampaign.md) | | [optional] | +| **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | +| **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**RedemptionEntryPromotionTierSummary**](RedemptionEntryPromotionTierSummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category_id** | **String** | Promotion tier category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/RedemptionEntryPromotionTierAction.md b/docs/RedemptionEntryPromotionTierAction.md new file mode 100644 index 00000000..9a01b222 --- /dev/null +++ b/docs/RedemptionEntryPromotionTierAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionEntryPromotionTierAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/RedemptionEntryPromotionTierCampaign.md b/docs/RedemptionEntryPromotionTierCampaign.md new file mode 100644 index 00000000..4628caa0 --- /dev/null +++ b/docs/RedemptionEntryPromotionTierCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::RedemptionEntryPromotionTierCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/RedemptionEntryPromotionTierSummary.md b/docs/RedemptionEntryPromotionTierSummary.md new file mode 100644 index 00000000..bd3e86d2 --- /dev/null +++ b/docs/RedemptionEntryPromotionTierSummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryPromotionTierSummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**RedemptionEntryPromotionTierSummaryRedemptions**](RedemptionEntryPromotionTierSummaryRedemptions.md) | | [optional] | +| **orders** | [**RedemptionEntryPromotionTierSummaryOrders**](RedemptionEntryPromotionTierSummaryOrders.md) | | [optional] | + diff --git a/docs/RedemptionEntryPromotionTierSummaryOrders.md b/docs/RedemptionEntryPromotionTierSummaryOrders.md new file mode 100644 index 00000000..fa27b43b --- /dev/null +++ b/docs/RedemptionEntryPromotionTierSummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryPromotionTierSummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/RedemptionEntryPromotionTierSummaryRedemptions.md b/docs/RedemptionEntryPromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..dacbf90f --- /dev/null +++ b/docs/RedemptionEntryPromotionTierSummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionEntryPromotionTierSummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/RedemptionEntryRelatedRedemptions.md b/docs/RedemptionEntryRelatedRedemptions.md new file mode 100644 index 00000000..3f5f812f --- /dev/null +++ b/docs/RedemptionEntryRelatedRedemptions.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryRelatedRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rollbacks** | [**Array<RedemptionEntryRelatedRedemptionsRollbacksItem>**](RedemptionEntryRelatedRedemptionsRollbacksItem.md) | | [optional] | +| **redemptions** | [**Array<RedemptionEntryRelatedRedemptionsRedemptionsItem>**](RedemptionEntryRelatedRedemptionsRedemptionsItem.md) | | [optional] | + diff --git a/docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..b7597a77 --- /dev/null +++ b/docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md b/docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..ce062f20 --- /dev/null +++ b/docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionEntryRelatedRedemptionsRollbacksItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionEntryVoucher.md b/docs/RedemptionEntryVoucher.md new file mode 100644 index 00000000..fdab5639 --- /dev/null +++ b/docs/RedemptionEntryVoucher.md @@ -0,0 +1,37 @@ +# VoucherifySdk::RedemptionEntryVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**RedemptionEntryVoucherGift**](RedemptionEntryVoucherGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionEntryVoucherLoyaltyCard**](RedemptionEntryVoucherLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**RedemptionEntryVoucherPublish**](RedemptionEntryVoucherPublish.md) | | [optional] | +| **redemption** | [**RedemptionEntryVoucherRedemption**](RedemptionEntryVoucherRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | + diff --git a/docs/RedemptionEntryVoucherGift.md b/docs/RedemptionEntryVoucherGift.md new file mode 100644 index 00000000..9e090ab8 --- /dev/null +++ b/docs/RedemptionEntryVoucherGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionEntryVoucherGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/RedemptionEntryVoucherLoyaltyCard.md b/docs/RedemptionEntryVoucherLoyaltyCard.md new file mode 100644 index 00000000..2bc5e009 --- /dev/null +++ b/docs/RedemptionEntryVoucherLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RedemptionEntryVoucherLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/RedemptionEntryVoucherPublish.md b/docs/RedemptionEntryVoucherPublish.md new file mode 100644 index 00000000..88a0c8da --- /dev/null +++ b/docs/RedemptionEntryVoucherPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionEntryVoucherPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/RedemptionEntryVoucherRedemption.md b/docs/RedemptionEntryVoucherRedemption.md new file mode 100644 index 00000000..bc1c860b --- /dev/null +++ b/docs/RedemptionEntryVoucherRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RedemptionEntryVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/RedemptionGift.md b/docs/RedemptionGift.md index bd05fa92..bbaadf4b 100644 --- a/docs/RedemptionGift.md +++ b/docs/RedemptionGift.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **amount** | **Integer** | The amount subtracted from the gift card expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | +| **amount** | **Integer** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | diff --git a/docs/RedemptionInternal.md b/docs/RedemptionInternal.md deleted file mode 100644 index 67e72692..00000000 --- a/docs/RedemptionInternal.md +++ /dev/null @@ -1,34 +0,0 @@ -# VoucherifySdk::RedemptionInternal - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | [optional] | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `redemption`. | [optional][default to 'redemption'] | -| **created_at** | **Time** | Timestamp representing the date and time when the redemption was created in ISO 8601 format. | [optional] | -| **tracking_id** | **String** | Hashed customer source ID. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] | -| **channel_type** | **String** | The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | -| **channel_id** | **String** | 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. | [optional] | -| **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | -| **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **previous_order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **reason** | **String** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] | -| **result** | **String** | Redemption result. | [optional] | -| **status** | **String** | Redemption status. | [optional] | -| **related_redemptions** | [**RedemptionInternalRelatedRedemptions**](RedemptionInternalRelatedRedemptions.md) | | [optional] | -| **parent_redemption_id** | **String** | Unique redemption ID of the parent redemption. | [optional] | -| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | -| **related_object_type** | **String** | Defines the related object. | [optional] | -| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] | -| **related_object_parent_id** | **String** | Unique related parent object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] | -| **campaign_name** | **String** | Campaign name | [optional] | -| **voucher** | [**Voucher**](Voucher.md) | | [optional] | -| **promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] | - diff --git a/docs/RedemptionInternalRelatedRedemptions.md b/docs/RedemptionInternalRelatedRedemptions.md deleted file mode 100644 index ad085319..00000000 --- a/docs/RedemptionInternalRelatedRedemptions.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedemptionInternalRelatedRedemptions - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **rollbacks** | [**Array<RedemptionInternalRelatedRedemptionsRollbacksItem>**](RedemptionInternalRelatedRedemptionsRollbacksItem.md) | | [optional] | -| **redemptions** | [**Array<RedemptionInternalRelatedRedemptionsItem>**](RedemptionInternalRelatedRedemptionsItem.md) | | [optional] | - diff --git a/docs/RedemptionInternalRelatedRedemptionsItem.md b/docs/RedemptionInternalRelatedRedemptionsItem.md deleted file mode 100644 index 212a3591..00000000 --- a/docs/RedemptionInternalRelatedRedemptionsItem.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedemptionInternalRelatedRedemptionsItem - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | - diff --git a/docs/RedemptionInternalRelatedRedemptionsRollbacksItem.md b/docs/RedemptionInternalRelatedRedemptionsRollbacksItem.md deleted file mode 100644 index 8cf5f1fc..00000000 --- a/docs/RedemptionInternalRelatedRedemptionsRollbacksItem.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedemptionInternalRelatedRedemptionsRollbacksItem - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique rollback redemption ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | - diff --git a/docs/RedemptionLoyaltyCard.md b/docs/RedemptionLoyaltyCard.md index ab01f2f3..39be0843 100644 --- a/docs/RedemptionLoyaltyCard.md +++ b/docs/RedemptionLoyaltyCard.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Number of points being added back to the loyalty card for the reward redemption rollback. | [optional] | +| **points** | **Integer** | Number of points subtracted from the loyalty card as a result of the redemption. | [optional] | diff --git a/docs/RedemptionRelatedRedemptions.md b/docs/RedemptionRelatedRedemptions.md index 8af6d7ee..ce9ba50b 100644 --- a/docs/RedemptionRelatedRedemptions.md +++ b/docs/RedemptionRelatedRedemptions.md @@ -5,5 +5,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **rollbacks** | [**Array<RedemptionRelatedRedemptionsRollbacksItem>**](RedemptionRelatedRedemptionsRollbacksItem.md) | | [optional] | -| **redemptions** | [**Array<RedemptionRelatedRedemptionsItem>**](RedemptionRelatedRedemptionsItem.md) | | [optional] | +| **redemptions** | [**Array<RedemptionRelatedRedemptionsRedemptionsItem>**](RedemptionRelatedRedemptionsRedemptionsItem.md) | | [optional] | diff --git a/docs/RedemptionRelatedRedemptionsItem.md b/docs/RedemptionRelatedRedemptionsItem.md deleted file mode 100644 index fb94aa2e..00000000 --- a/docs/RedemptionRelatedRedemptionsItem.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedemptionRelatedRedemptionsItem - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | - diff --git a/docs/RedemptionRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..4e697f16 --- /dev/null +++ b/docs/RedemptionRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionRelatedRedemptionsRollbacksItem.md b/docs/RedemptionRelatedRedemptionsRollbacksItem.md index 32ceee3d..81e75b08 100644 --- a/docs/RedemptionRelatedRedemptionsRollbacksItem.md +++ b/docs/RedemptionRelatedRedemptionsRollbacksItem.md @@ -5,5 +5,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique rollback redemption ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/RedemptionRewardResult.md b/docs/RedemptionRewardResult.md index 51b583f2..7c6b0654 100644 --- a/docs/RedemptionRewardResult.md +++ b/docs/RedemptionRewardResult.md @@ -4,17 +4,18 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | | -| **assignment_id** | **String** | Unique reward assignment ID assigned by Voucherify. | | -| **voucher** | [**RedemptionRewardResultVoucher**](RedemptionRewardResultVoucher.md) | | | -| **product** | [**RedemptionRewardResultProduct**](RedemptionRewardResultProduct.md) | | | -| **sku** | [**RedemptionRewardResultSku**](RedemptionRewardResultSku.md) | | | -| **loyalty_tier_id** | **String** | Unique loyalty tier ID assigned by Voucherify. | | +| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | +| **assignment_id** | **String** | Unique reward assignment ID assigned by Voucherify. | [optional] | +| **voucher** | [**Voucher**](Voucher.md) | | [optional] | +| **product** | [**Product**](Product.md) | | [optional] | +| **sku** | [**Sku**](Sku.md) | | [optional] | +| **loyalty_tier_id** | **String** | Unique loyalty tier ID assigned by Voucherify. | [optional] | | **id** | **String** | Unique reward ID. | [optional] | | **name** | **String** | Name of the reward. | [optional] | -| **object** | **String** | The type of object represented by the JSON | [optional][default to 'reward'] | -| **created_at** | **Time** | Timestamp representing the date and time when the redemption was created in ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON | [optional][default to 'reward'] | +| **created_at** | **Time** | Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp in ISO 8601 format indicating when the reward was updated. | [optional] | | **parameters** | [**RedemptionRewardResultParameters**](RedemptionRewardResultParameters.md) | | [optional] | +| **metadata** | **Object** | 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. | [optional] | | **type** | **String** | Reward type. | [optional] | diff --git a/docs/RedemptionRewardResultParametersProduct.md b/docs/RedemptionRewardResultParametersProduct.md index 1efcae0f..9d6d0eb5 100644 --- a/docs/RedemptionRewardResultParametersProduct.md +++ b/docs/RedemptionRewardResultParametersProduct.md @@ -5,5 +5,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | Unique product ID, assigned by Voucherify. | [optional] | -| **sku_id** | **String** | A unique SKU ID assigned by Voucherify. | [optional] | +| **sku_id** | **String** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] | diff --git a/docs/RedemptionRewardResultProduct.md b/docs/RedemptionRewardResultProduct.md deleted file mode 100644 index 3169519b..00000000 --- a/docs/RedemptionRewardResultProduct.md +++ /dev/null @@ -1,18 +0,0 @@ -# VoucherifySdk::RedemptionRewardResultProduct - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID assigned by Voucherify. | | -| **source_id** | **String** | Unique product source ID. | | -| **name** | **String** | Unique user-defined product name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **attributes** | **Array<String>** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the product was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the product was updated in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the product. | [default to 'product'] | -| **skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] | - diff --git a/docs/RedemptionRewardResultSku.md b/docs/RedemptionRewardResultSku.md deleted file mode 100644 index 967ca767..00000000 --- a/docs/RedemptionRewardResultSku.md +++ /dev/null @@ -1,19 +0,0 @@ -# VoucherifySdk::RedemptionRewardResultSku - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | | -| **source_id** | **String** | A unique SKU identifier from your inventory system. | | -| **product_id** | **String** | The parent product's unique ID. | | -| **sku** | **String** | Unique user-defined SKU name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **currency** | **String** | SKU price currency. | [optional] | -| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `SKU`. | [default to 'sku'] | - diff --git a/docs/RedemptionRewardResultVoucher.md b/docs/RedemptionRewardResultVoucher.md deleted file mode 100644 index 29717cf9..00000000 --- a/docs/RedemptionRewardResultVoucher.md +++ /dev/null @@ -1,37 +0,0 @@ -# VoucherifySdk::RedemptionRewardResultVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | -| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | -| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | -| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | -| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | -| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | -| **type** | **String** | Defines the type of the voucher. | [optional] | -| **discount** | [**Discount**](Discount.md) | | [optional] | -| **gift** | [**VoucherGift**](VoucherGift.md) | | [optional] | -| **loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] | -| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | -| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**VoucherValidityTimeframe**](VoucherValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | -| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | -| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | -| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | -| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | -| **distributions** | **Array<Object>** | | [optional] | -| **deleted** | **Boolean** | Flag indicating whether this voucher is deleted. | [optional] | -| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | -| **publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] | -| **redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] | - diff --git a/docs/RedemptionRollback.md b/docs/RedemptionRollback.md index 2710b7ab..b358ebe4 100644 --- a/docs/RedemptionRollback.md +++ b/docs/RedemptionRollback.md @@ -4,28 +4,28 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | | -| **object** | **String** | The type of object represented by the JSON | [default to 'redemption_rollback'] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the redeeming customer. | | -| **tracking_id** | **String** | Hashed customer source ID. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **redemption** | **String** | Unique redemption ID of the parent redemption. | | +| **id** | **String** | Unique identifier of the redemption rollback. | [optional] | +| **object** | **String** | The type of the object represented by the JSON | [optional][default to 'redemption_rollback'] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] | +| **amount** | **Integer** | For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | | **reason** | **String** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] | -| **result** | **String** | Redemption result. | | -| **status** | **String** | Redemption status. | | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | Redemption status. | [optional] | | **related_redemptions** | [**RedemptionRollbackRelatedRedemptions**](RedemptionRollbackRelatedRedemptions.md) | | [optional] | | **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | | **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | -| **order** | [**OrderCalculatedNoCustomerData**](OrderCalculatedNoCustomerData.md) | | | -| **channel** | [**RedemptionChannel**](RedemptionChannel.md) | | | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | | -| **related_object_type** | **String** | Defines the related object. | | -| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | +| **channel** | [**RedemptionRollbackChannel**](RedemptionRollbackChannel.md) | | [optional] | +| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] | | **voucher** | [**Voucher**](Voucher.md) | | [optional] | | **promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] | | **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | -| **gift** | [**RedemptionGift**](RedemptionGift.md) | | [optional] | -| **loyalty_card** | [**RedemptionLoyaltyCard**](RedemptionLoyaltyCard.md) | | [optional] | +| **gift** | [**RedemptionRollbackGift**](RedemptionRollbackGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionRollbackLoyaltyCard**](RedemptionRollbackLoyaltyCard.md) | | [optional] | diff --git a/docs/RedemptionRollbackChannel.md b/docs/RedemptionRollbackChannel.md new file mode 100644 index 00000000..2e43e16d --- /dev/null +++ b/docs/RedemptionRollbackChannel.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionRollbackChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **channel_id** | **String** | Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] | +| **channel_type** | **String** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | + diff --git a/docs/RedemptionRollbackGift.md b/docs/RedemptionRollbackGift.md new file mode 100644 index 00000000..39c3141e --- /dev/null +++ b/docs/RedemptionRollbackGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionRollbackGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] | + diff --git a/docs/RedemptionRollbackLoyaltyCard.md b/docs/RedemptionRollbackLoyaltyCard.md new file mode 100644 index 00000000..0c13e2f4 --- /dev/null +++ b/docs/RedemptionRollbackLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionRollbackLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] | + diff --git a/docs/RedemptionRollbackRelatedRedemptions.md b/docs/RedemptionRollbackRelatedRedemptions.md index e817c47e..99510e11 100644 --- a/docs/RedemptionRollbackRelatedRedemptions.md +++ b/docs/RedemptionRollbackRelatedRedemptions.md @@ -5,5 +5,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **rollbacks** | [**Array<RedemptionRollbackRelatedRedemptionsRollbacksItem>**](RedemptionRollbackRelatedRedemptionsRollbacksItem.md) | | [optional] | -| **redemptions** | [**Array<RedemptionRollbackRelatedRedemptionsItem>**](RedemptionRollbackRelatedRedemptionsItem.md) | | [optional] | +| **redemptions** | [**Array<RedemptionRollbackRelatedRedemptionsRedemptionsItem>**](RedemptionRollbackRelatedRedemptionsRedemptionsItem.md) | | [optional] | diff --git a/docs/RedemptionRollbackRelatedRedemptionsItem.md b/docs/RedemptionRollbackRelatedRedemptionsItem.md deleted file mode 100644 index a0a26de5..00000000 --- a/docs/RedemptionRollbackRelatedRedemptionsItem.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RedemptionRollbackRelatedRedemptionsItem - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | - diff --git a/docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..f7181518 --- /dev/null +++ b/docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionRollbackRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md b/docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md index 8a092abf..613ec176 100644 --- a/docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md +++ b/docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique rollback redemption ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] | +| **id** | **String** | Unique identifier of the redemption rollback. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/RedemptionVoucher.md b/docs/RedemptionVoucher.md new file mode 100644 index 00000000..e8cffe99 --- /dev/null +++ b/docs/RedemptionVoucher.md @@ -0,0 +1,37 @@ +# VoucherifySdk::RedemptionVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**RedemptionVoucherGift**](RedemptionVoucherGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionVoucherLoyaltyCard**](RedemptionVoucherLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**RedemptionVoucherPublish**](RedemptionVoucherPublish.md) | | [optional] | +| **redemption** | [**RedemptionVoucherRedemption**](RedemptionVoucherRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | + diff --git a/docs/RedemptionVoucherGift.md b/docs/RedemptionVoucherGift.md new file mode 100644 index 00000000..a3191ce7 --- /dev/null +++ b/docs/RedemptionVoucherGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionVoucherGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/RedemptionVoucherLoyaltyCard.md b/docs/RedemptionVoucherLoyaltyCard.md new file mode 100644 index 00000000..e16c4d42 --- /dev/null +++ b/docs/RedemptionVoucherLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RedemptionVoucherLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/RedemptionVoucherPublish.md b/docs/RedemptionVoucherPublish.md new file mode 100644 index 00000000..8db00e64 --- /dev/null +++ b/docs/RedemptionVoucherPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionVoucherPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/RedemptionVoucherRedemption.md b/docs/RedemptionVoucherRedemption.md new file mode 100644 index 00000000..7e68c048 --- /dev/null +++ b/docs/RedemptionVoucherRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RedemptionVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/RedemptionsApi.md b/docs/RedemptionsApi.md index 1fb70b17..03c263b9 100644 --- a/docs/RedemptionsApi.md +++ b/docs/RedemptionsApi.md @@ -156,8 +156,8 @@ end api_instance = VoucherifySdk::RedemptionsApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. result: 'result_example', # String | A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. campaign: 'campaign_example', # String | A filter by the campaign **name** that the redemption resources originate from. customer: 'customer_example', # String | Return redemptions performed by the customer with given id or source_id. @@ -179,8 +179,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **result** | **String** | A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. | [optional] | | **campaign** | **String** | A filter by the campaign **name** that the redemption resources originate from. | [optional] | | **customer** | **String** | Return redemptions performed by the customer with given id or source_id. | [optional] | @@ -230,7 +230,7 @@ end api_instance = VoucherifySdk::RedemptionsApi.new opts = { - redemptions_redeem_request_body: VoucherifySdk::RedemptionsRedeemRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # RedemptionsRedeemRequestBody | + redemptions_redeem_request_body: VoucherifySdk::RedemptionsRedeemRequestBody.new # RedemptionsRedeemRequestBody | } begin @@ -268,7 +268,7 @@ end Rollback Redemption -Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. +Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. 🚧 You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. ### Examples @@ -334,7 +334,7 @@ end Rollback Stackable Redemptions -Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. +Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. 🚧 You can roll back a redemption up to 3 months back. ### Examples diff --git a/docs/RedemptionsGetResponseBody.md b/docs/RedemptionsGetResponseBody.md index 1313090a..87b40f8e 100644 --- a/docs/RedemptionsGetResponseBody.md +++ b/docs/RedemptionsGetResponseBody.md @@ -1,49 +1,31 @@ # VoucherifySdk::RedemptionsGetResponseBody -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RedemptionsGetResponseBody.openapi_one_of -# => -# [ -# :'Redemption', -# :'RedemptionRollback' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RedemptionsGetResponseBody.build(data) -# => # - -VoucherifySdk::RedemptionsGetResponseBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `Redemption` -- `RedemptionRollback` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | | [optional] | +| **amount** | **Integer** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | | [optional] | +| **related_redemptions** | [**RedemptionsGetResponseBodyRelatedRedemptions**](RedemptionsGetResponseBodyRelatedRedemptions.md) | | [optional] | +| **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | +| **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | +| **order** | [**RedemptionsGetResponseBodyOrder**](RedemptionsGetResponseBodyOrder.md) | | [optional] | +| **channel** | [**RedemptionsGetResponseBodyChannel**](RedemptionsGetResponseBodyChannel.md) | | [optional] | +| **customer** | [**RedemptionsGetResponseBodyCustomer**](RedemptionsGetResponseBodyCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | | [optional] | +| **voucher** | [**RedemptionsGetResponseBodyVoucher**](RedemptionsGetResponseBodyVoucher.md) | | [optional] | +| **promotion_tier** | [**RedemptionsGetResponseBodyPromotionTier**](RedemptionsGetResponseBodyPromotionTier.md) | | [optional] | +| **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | +| **gift** | [**RedemptionsGetResponseBodyGift**](RedemptionsGetResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionsGetResponseBodyLoyaltyCard**](RedemptionsGetResponseBodyLoyaltyCard.md) | | [optional] | +| **reason** | **String** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] | diff --git a/docs/RedemptionsGetResponseBodyChannel.md b/docs/RedemptionsGetResponseBodyChannel.md new file mode 100644 index 00000000..cebc59d5 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyChannel.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **channel_id** | **String** | | [optional] | +| **channel_type** | **String** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyCustomer.md b/docs/RedemptionsGetResponseBodyCustomer.md new file mode 100644 index 00000000..295e8d11 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyCustomer.md @@ -0,0 +1,13 @@ +# VoucherifySdk::RedemptionsGetResponseBodyCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] | +| **name** | **String** | Customer's first and last name. | [optional] | +| **email** | **String** | Customer's email address. | [optional] | +| **source_id** | **String** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] | +| **metadata** | **Object** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionsGetResponseBodyGift.md b/docs/RedemptionsGetResponseBodyGift.md new file mode 100644 index 00000000..e18ff755 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsGetResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyLoyaltyCard.md b/docs/RedemptionsGetResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..ccb6a0b0 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsGetResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyOrder.md b/docs/RedemptionsGetResponseBodyOrder.md new file mode 100644 index 00000000..5c8e7bce --- /dev/null +++ b/docs/RedemptionsGetResponseBodyOrder.md @@ -0,0 +1,29 @@ +# VoucherifySdk::RedemptionsGetResponseBodyOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | +| **status** | **String** | The order status. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **items_discount_amount** | **Integer** | Sum of all product-specific discounts applied to the order. | [optional] | +| **total_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] | +| **total_amount** | **Integer** | Order amount after undoing all the discounts through the rollback redemption. | [optional] | +| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | +| **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | +| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | +| **metadata** | **Object** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | +| **customer** | [**RedemptionsGetResponseBodyOrderCustomer**](RedemptionsGetResponseBodyOrderCustomer.md) | | [optional] | +| **referrer** | [**RedemptionsGetResponseBodyOrderReferrer**](RedemptionsGetResponseBodyOrderReferrer.md) | | [optional] | +| **redemptions** | **Object** | | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyOrderCustomer.md b/docs/RedemptionsGetResponseBodyOrderCustomer.md new file mode 100644 index 00000000..fb75c190 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyOrderCustomer.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyOrderCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionsGetResponseBodyOrderReferrer.md b/docs/RedemptionsGetResponseBodyOrderReferrer.md new file mode 100644 index 00000000..f1bccd2a --- /dev/null +++ b/docs/RedemptionsGetResponseBodyOrderReferrer.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyOrderReferrer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionsGetResponseBodyPromotionTier.md b/docs/RedemptionsGetResponseBodyPromotionTier.md new file mode 100644 index 00000000..44713ddc --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTier.md @@ -0,0 +1,29 @@ +# VoucherifySdk::RedemptionsGetResponseBodyPromotionTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique promotion tier ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**RedemptionsGetResponseBodyPromotionTierAction**](RedemptionsGetResponseBodyPromotionTierAction.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **promotion_id** | **String** | Promotion unique ID. | [optional] | +| **campaign** | [**RedemptionsGetResponseBodyPromotionTierCampaign**](RedemptionsGetResponseBodyPromotionTierCampaign.md) | | [optional] | +| **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | +| **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**RedemptionsGetResponseBodyPromotionTierSummary**](RedemptionsGetResponseBodyPromotionTierSummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category_id** | **String** | Promotion tier category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyPromotionTierAction.md b/docs/RedemptionsGetResponseBodyPromotionTierAction.md new file mode 100644 index 00000000..61fc98dd --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsGetResponseBodyPromotionTierAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyPromotionTierCampaign.md b/docs/RedemptionsGetResponseBodyPromotionTierCampaign.md new file mode 100644 index 00000000..fa2b259f --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::RedemptionsGetResponseBodyPromotionTierCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/RedemptionsGetResponseBodyPromotionTierSummary.md b/docs/RedemptionsGetResponseBodyPromotionTierSummary.md new file mode 100644 index 00000000..a069b818 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierSummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyPromotionTierSummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**RedemptionsGetResponseBodyPromotionTierSummaryRedemptions**](RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md) | | [optional] | +| **orders** | [**RedemptionsGetResponseBodyPromotionTierSummaryOrders**](RedemptionsGetResponseBodyPromotionTierSummaryOrders.md) | | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md b/docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md new file mode 100644 index 00000000..9e5583b7 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyPromotionTierSummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md b/docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..6a284663 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsGetResponseBodyPromotionTierSummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyRelatedRedemptions.md b/docs/RedemptionsGetResponseBodyRelatedRedemptions.md new file mode 100644 index 00000000..c6b2bc81 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyRelatedRedemptions.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyRelatedRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rollbacks** | [**Array<RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem>**](RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] | +| **redemptions** | [**Array<RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem>**](RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md) | | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..06e9dd10 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..b0150f1d --- /dev/null +++ b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyVoucher.md b/docs/RedemptionsGetResponseBodyVoucher.md new file mode 100644 index 00000000..8451c9e3 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucher.md @@ -0,0 +1,37 @@ +# VoucherifySdk::RedemptionsGetResponseBodyVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**RedemptionsGetResponseBodyVoucherGift**](RedemptionsGetResponseBodyVoucherGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionsGetResponseBodyVoucherLoyaltyCard**](RedemptionsGetResponseBodyVoucherLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**RedemptionsGetResponseBodyVoucherPublish**](RedemptionsGetResponseBodyVoucherPublish.md) | | [optional] | +| **redemption** | [**RedemptionsGetResponseBodyVoucherRedemption**](RedemptionsGetResponseBodyVoucherRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyVoucherGift.md b/docs/RedemptionsGetResponseBodyVoucherGift.md new file mode 100644 index 00000000..6fc5bafe --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionsGetResponseBodyVoucherGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md b/docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md new file mode 100644 index 00000000..aac5c2ac --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RedemptionsGetResponseBodyVoucherLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyVoucherPublish.md b/docs/RedemptionsGetResponseBodyVoucherPublish.md new file mode 100644 index 00000000..98de436e --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionsGetResponseBodyVoucherPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/RedemptionsGetResponseBodyVoucherRedemption.md b/docs/RedemptionsGetResponseBodyVoucherRedemption.md new file mode 100644 index 00000000..68066eaa --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RedemptionsGetResponseBodyVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/RedemptionsListResponseBody.md b/docs/RedemptionsListResponseBody.md index bf64937c..9dc36377 100644 --- a/docs/RedemptionsListResponseBody.md +++ b/docs/RedemptionsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about redemptions in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of redemption objects. | [default to 'redemptions'] | -| **redemptions** | [**Array<RedemptionsListResponseBodyRedemptionsItem>**](RedemptionsListResponseBodyRedemptionsItem.md) | | | -| **total** | **Integer** | Total number of redemptions. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about redemptions in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of redemption objects. | [optional][default to 'redemptions'] | +| **redemptions** | [**Array<RedemptionsListResponseBodyRedemptionsItem>**](RedemptionsListResponseBodyRedemptionsItem.md) | | [optional] | +| **total** | **Integer** | Total number of redemptions. | [optional] | diff --git a/docs/RedemptionsListResponseBodyRedemptionsItem.md b/docs/RedemptionsListResponseBodyRedemptionsItem.md index 2ad50530..4e46097c 100644 --- a/docs/RedemptionsListResponseBodyRedemptionsItem.md +++ b/docs/RedemptionsListResponseBodyRedemptionsItem.md @@ -1,49 +1,31 @@ # VoucherifySdk::RedemptionsListResponseBodyRedemptionsItem -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RedemptionsListResponseBodyRedemptionsItem.openapi_one_of -# => -# [ -# :'Redemption', -# :'RedemptionRollback' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RedemptionsListResponseBodyRedemptionsItem.build(data) -# => # - -VoucherifySdk::RedemptionsListResponseBodyRedemptionsItem.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `Redemption` -- `RedemptionRollback` -- `nil` (if no type matches) +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | | [optional] | +| **amount** | **Integer** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | | [optional] | +| **related_redemptions** | [**RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md) | | [optional] | +| **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | +| **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | +| **order** | [**RedemptionsListResponseBodyRedemptionsItemOrder**](RedemptionsListResponseBodyRedemptionsItemOrder.md) | | [optional] | +| **channel** | [**RedemptionsListResponseBodyRedemptionsItemChannel**](RedemptionsListResponseBodyRedemptionsItemChannel.md) | | [optional] | +| **customer** | [**RedemptionsListResponseBodyRedemptionsItemCustomer**](RedemptionsListResponseBodyRedemptionsItemCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | | [optional] | +| **voucher** | [**RedemptionsListResponseBodyRedemptionsItemVoucher**](RedemptionsListResponseBodyRedemptionsItemVoucher.md) | | [optional] | +| **promotion_tier** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTier**](RedemptionsListResponseBodyRedemptionsItemPromotionTier.md) | | [optional] | +| **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | +| **gift** | [**RedemptionsListResponseBodyRedemptionsItemGift**](RedemptionsListResponseBodyRedemptionsItemGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionsListResponseBodyRedemptionsItemLoyaltyCard**](RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md) | | [optional] | +| **reason** | **String** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] | diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemChannel.md b/docs/RedemptionsListResponseBodyRedemptionsItemChannel.md new file mode 100644 index 00000000..527f5f77 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemChannel.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **channel_id** | **String** | | [optional] | +| **channel_type** | **String** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md b/docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md new file mode 100644 index 00000000..125d2bf6 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md @@ -0,0 +1,13 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] | +| **name** | **String** | Customer's first and last name. | [optional] | +| **email** | **String** | Customer's email address. | [optional] | +| **source_id** | **String** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] | +| **metadata** | **Object** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemGift.md b/docs/RedemptionsListResponseBodyRedemptionsItemGift.md new file mode 100644 index 00000000..01cee0da --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md b/docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md new file mode 100644 index 00000000..27fffd1d --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md b/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md new file mode 100644 index 00000000..4fadf74e --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md @@ -0,0 +1,29 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemOrder + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | +| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | +| **status** | **String** | The order status. | [optional] | +| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **initial_amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | +| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | +| **items_discount_amount** | **Integer** | Sum of all product-specific discounts applied to the order. | [optional] | +| **total_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] | +| **total_amount** | **Integer** | Order amount after undoing all the discounts through the rollback redemption. | [optional] | +| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | +| **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | +| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | +| **items** | [**Array<OrderCalculatedItem>**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] | +| **metadata** | **Object** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'order'] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | +| **referrer_id** | **String** | Unique referrer ID. | [optional] | +| **customer** | [**RedemptionsListResponseBodyRedemptionsItemOrderCustomer**](RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md) | | [optional] | +| **referrer** | [**RedemptionsListResponseBodyRedemptionsItemOrderReferrer**](RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md) | | [optional] | +| **redemptions** | **Object** | | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md b/docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md new file mode 100644 index 00000000..f243bdfa --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemOrderCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md b/docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md new file mode 100644 index 00000000..b64d2bc9 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemOrderReferrer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md new file mode 100644 index 00000000..48634d09 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md @@ -0,0 +1,29 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTier + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique promotion tier ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] | +| **name** | **String** | Name of the promotion tier. | [optional] | +| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | +| **action** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierAction**](RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **hierarchy** | **Integer** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] | +| **promotion_id** | **String** | Promotion unique ID. | [optional] | +| **campaign** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign**](RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md) | | [optional] | +| **campaign_id** | **String** | Promotion tier's parent campaign's unique ID. | [optional] | +| **active** | **Boolean** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **summary** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md) | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional][default to 'promotion_tier'] | +| **validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] | +| **category_id** | **String** | Promotion tier category ID. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md new file mode 100644 index 00000000..e6d8c799 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md new file mode 100644 index 00000000..f1f19016 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md @@ -0,0 +1,16 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique campaign ID. | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] | +| **category_id** | **String** | Unique category ID that this campaign belongs to. | [optional] | +| **object** | **String** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional][default to 'campaign'] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md new file mode 100644 index 00000000..4ccf1b10 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **redemptions** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md) | | [optional] | +| **orders** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md) | | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md new file mode 100644 index 00000000..0a6f2289 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_amount** | **Integer** | Sum of order totals. | [optional] | +| **total_discount_amount** | **Integer** | Sum of total discount applied using the promotion tier. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..3c69a503 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_redeemed** | **Integer** | Number of times the promotion tier was redeemed. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md new file mode 100644 index 00000000..aafe7353 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rollbacks** | [**Array<RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem>**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md) | | [optional] | +| **redemptions** | [**Array<RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem>**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md) | | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..1e917d48 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..c15f77a5 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md new file mode 100644 index 00000000..07c604c5 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md @@ -0,0 +1,37 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucher + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**RedemptionsListResponseBodyRedemptionsItemVoucherGift**](RedemptionsListResponseBodyRedemptionsItemVoucherGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard**](RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**RedemptionsListResponseBodyRedemptionsItemVoucherPublish**](RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md) | | [optional] | +| **redemption** | [**RedemptionsListResponseBodyRedemptionsItemVoucherRedemption**](RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md new file mode 100644 index 00000000..7902a992 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md new file mode 100644 index 00000000..d5ded7ce --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md new file mode 100644 index 00000000..63bba70b --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md new file mode 100644 index 00000000..1502a0c6 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RedemptionsListResponseBodyRedemptionsItemVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/RedemptionsRedeemRequestBody.md b/docs/RedemptionsRedeemRequestBody.md index 00454317..16bf936e 100644 --- a/docs/RedemptionsRedeemRequestBody.md +++ b/docs/RedemptionsRedeemRequestBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemables** | [**Array<StackableValidateRedeemBaseRedeemablesItem>**](StackableValidateRedeemBaseRedeemablesItem.md) | An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. | | +| **options** | [**RedemptionsRedeemRequestBodyOptions**](RedemptionsRedeemRequestBodyOptions.md) | | [optional] | +| **redeemables** | [**Array<RedemptionsRedeemRequestBodyRedeemablesItem>**](RedemptionsRedeemRequestBodyRedeemablesItem.md) | | [optional] | | **order** | [**Order**](Order.md) | | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | | **session** | [**Session**](Session.md) | | [optional] | | **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | | **metadata** | **Object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] | -| **options** | [**ClientRedemptionsRedeemRequestBodyAllOfOptions**](ClientRedemptionsRedeemRequestBodyAllOfOptions.md) | | [optional] | diff --git a/docs/RedemptionsRedeemRequestBodyOptions.md b/docs/RedemptionsRedeemRequestBodyOptions.md new file mode 100644 index 00000000..7e20d428 --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyOptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsRedeemRequestBodyOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expand** | **Array<String>** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] | + diff --git a/docs/RedemptionsRedeemRequestBodyRedeemablesItem.md b/docs/RedemptionsRedeemRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..d2788a19 --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyRedeemablesItem.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RedemptionsRedeemRequestBodyRedeemablesItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | +| **id** | **String** | | [optional] | +| **gift** | [**RedemptionsRedeemRequestBodyRedeemablesItemGift**](RedemptionsRedeemRequestBodyRedeemablesItemGift.md) | | [optional] | +| **reward** | [**RedemptionsRedeemRequestBodyRedeemablesItemReward**](RedemptionsRedeemRequestBodyRedeemablesItemReward.md) | | [optional] | + diff --git a/docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md b/docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..70313579 --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsRedeemRequestBodyRedeemablesItemGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **credits** | **Integer** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | + diff --git a/docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md b/docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..0dfde0f5 --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsRedeemRequestBodyRedeemablesItemReward + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] | +| **points** | **Integer** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] | + diff --git a/docs/RedemptionsRollbackCreateResponseBody.md b/docs/RedemptionsRollbackCreateResponseBody.md index 895345bb..2bde130e 100644 --- a/docs/RedemptionsRollbackCreateResponseBody.md +++ b/docs/RedemptionsRollbackCreateResponseBody.md @@ -4,28 +4,28 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | | -| **object** | **String** | The type of object represented by the JSON | [default to 'redemption_rollback'] | -| **date** | **Time** | Timestamp representing the date and time when the object was created in ISO 8601 format. | | -| **customer_id** | **String** | Unique customer ID of the redeeming customer. | | -| **tracking_id** | **String** | Hashed customer source ID. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **redemption** | **String** | Unique redemption ID of the parent redemption. | | +| **id** | **String** | Unique identifier of the redemption rollback. | [optional] | +| **object** | **String** | The type of the object represented by the JSON | [optional][default to 'redemption_rollback'] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | +| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | +| **tracking_id** | **String** | Hashed customer source ID. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] | +| **amount** | **Integer** | For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] | +| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | | **reason** | **String** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] | -| **result** | **String** | Redemption result. | | -| **status** | **String** | Redemption status. | | -| **related_redemptions** | [**RedemptionRollbackRelatedRedemptions**](RedemptionRollbackRelatedRedemptions.md) | | [optional] | +| **result** | **String** | Redemption result. | [optional] | +| **status** | **String** | Redemption status. | [optional] | +| **related_redemptions** | [**RedemptionsRollbackCreateResponseBodyRelatedRedemptions**](RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md) | | [optional] | | **failure_code** | **String** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] | | **failure_message** | **String** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] | -| **order** | [**OrderCalculatedNoCustomerData**](OrderCalculatedNoCustomerData.md) | | | -| **channel** | [**RedemptionChannel**](RedemptionChannel.md) | | | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | | -| **related_object_type** | **String** | Defines the related object. | | -| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | +| **channel** | [**RedemptionsRollbackCreateResponseBodyChannel**](RedemptionsRollbackCreateResponseBodyChannel.md) | | [optional] | +| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | +| **related_object_type** | **String** | Defines the related object. | [optional] | +| **related_object_id** | **String** | Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] | | **voucher** | [**Voucher**](Voucher.md) | | [optional] | | **promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] | | **reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] | -| **gift** | [**RedemptionGift**](RedemptionGift.md) | | [optional] | -| **loyalty_card** | [**RedemptionLoyaltyCard**](RedemptionLoyaltyCard.md) | | [optional] | +| **gift** | [**RedemptionsRollbackCreateResponseBodyGift**](RedemptionsRollbackCreateResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**RedemptionsRollbackCreateResponseBodyLoyaltyCard**](RedemptionsRollbackCreateResponseBodyLoyaltyCard.md) | | [optional] | diff --git a/docs/RedemptionsRollbackCreateResponseBodyChannel.md b/docs/RedemptionsRollbackCreateResponseBodyChannel.md new file mode 100644 index 00000000..1de31cb5 --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyChannel.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsRollbackCreateResponseBodyChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **channel_id** | **String** | Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] | +| **channel_type** | **String** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] | + diff --git a/docs/RedemptionsRollbackCreateResponseBodyGift.md b/docs/RedemptionsRollbackCreateResponseBodyGift.md new file mode 100644 index 00000000..0eaa8363 --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsRollbackCreateResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] | + diff --git a/docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md b/docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..c273fb0a --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RedemptionsRollbackCreateResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] | + diff --git a/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md new file mode 100644 index 00000000..49c025dd --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsRollbackCreateResponseBodyRelatedRedemptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rollbacks** | [**Array<RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem>**](RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] | +| **redemptions** | [**Array<RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem>**](RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md) | | [optional] | + diff --git a/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..8a95af7e --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique redemption ID. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..7279ccde --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of the redemption rollback. | [optional] | +| **date** | **Time** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] | + diff --git a/docs/RedemptionsRollbacksCreateResponseBody.md b/docs/RedemptionsRollbacksCreateResponseBody.md index f8a63ea2..f13469ed 100644 --- a/docs/RedemptionsRollbacksCreateResponseBody.md +++ b/docs/RedemptionsRollbacksCreateResponseBody.md @@ -6,5 +6,5 @@ | ---- | ---- | ----------- | ----- | | **rollbacks** | [**Array<RedemptionRollback>**](RedemptionRollback.md) | Contains the rollback redemption objects of the particular incentives. | [optional] | | **parent_rollback** | [**RedemptionRollback**](RedemptionRollback.md) | | [optional] | -| **order** | [**OrderCalculatedNoCustomerData**](OrderCalculatedNoCustomerData.md) | | [optional] | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | diff --git a/docs/ReferralCampaignVoucher.md b/docs/ReferralCampaignVoucher.md deleted file mode 100644 index de81358d..00000000 --- a/docs/ReferralCampaignVoucher.md +++ /dev/null @@ -1,12 +0,0 @@ -# VoucherifySdk::ReferralCampaignVoucher - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Type of voucher. | [default to 'DISCOUNT_VOUCHER'] | -| **discount** | [**Discount**](Discount.md) | | | -| **code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] | -| **redemption** | [**CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] | -| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | | - diff --git a/docs/Referrer.md b/docs/Referrer.md index 49ad22bf..9295bd7b 100644 --- a/docs/Referrer.md +++ b/docs/Referrer.md @@ -10,8 +10,8 @@ | **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | +| **birthday** | **Date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] | | **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | +| **address** | [**ReferrerAddress**](ReferrerAddress.md) | | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | diff --git a/docs/ReferrerAddress.md b/docs/ReferrerAddress.md new file mode 100644 index 00000000..204a774e --- /dev/null +++ b/docs/ReferrerAddress.md @@ -0,0 +1,13 @@ +# VoucherifySdk::ReferrerAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **line_1** | **String** | First line of address. | [optional] | +| **line_2** | **String** | Second line of address. | [optional] | +| **country** | **String** | Country. | [optional] | +| **postal_code** | **String** | Postal code. | [optional] | + diff --git a/docs/ReferrerId.md b/docs/ReferrerId.md index f9236e7e..ba13ca44 100644 --- a/docs/ReferrerId.md +++ b/docs/ReferrerId.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier of an existing customer. | | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | +| **id** | **String** | A unique identifier of an existing customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | diff --git a/docs/ReferrerWithSummaryLoyaltyReferrals.md b/docs/ReferrerWithSummaryLoyaltyReferrals.md deleted file mode 100644 index 4b456e9f..00000000 --- a/docs/ReferrerWithSummaryLoyaltyReferrals.md +++ /dev/null @@ -1,25 +0,0 @@ -# VoucherifySdk::ReferrerWithSummaryLoyaltyReferrals - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | -| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | -| **summary** | [**CustomerSummary**](CustomerSummary.md) | | | -| **loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | | -| **referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | | -| **system_metadata** | **Object** | Object used to store system metadata information. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the customer was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the customer was updated in ISO 8601 format. | [optional] | -| **assets** | [**CustomerResponseDataAssets**](CustomerResponseDataAssets.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'customer'] | -| **name** | **String** | Customer's first and last name. | [optional] | -| **description** | **String** | An arbitrary string that you can attach to a customer object. | [optional] | -| **email** | **String** | Customer's email address. | [optional] | -| **phone** | **String** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] | -| **birthday** | **Date** | *Deprecated* Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **birthdate** | **Date** | Customer's birthdate; format YYYY-MM-DD. | [optional] | -| **address** | [**CustomerBaseAddress**](CustomerBaseAddress.md) | | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | - diff --git a/docs/Reward.md b/docs/Reward.md index 5e7764a6..0b754d07 100644 --- a/docs/Reward.md +++ b/docs/Reward.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward ID, assigned by Voucherify. | | -| **name** | **String** | Reward name. | | -| **stock** | **Integer** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | | -| **redeemed** | **Integer** | Defines the number of already invoked (successful) reward redemptions. | | +| **id** | **String** | Unique reward ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Reward name. | [optional] | +| **stock** | **Integer** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] | +| **redeemed** | **Integer** | Defines the number of already invoked (successful) reward redemptions. | [optional] | | **attributes** | [**RewardAttributes**](RewardAttributes.md) | | [optional] | -| **metadata** | **Object** | 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. | | -| **type** | **String** | Reward type. | | +| **metadata** | **Object** | 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. | [optional] | +| **type** | **String** | Reward type. | [optional] | | **parameters** | [**RewardType**](RewardType.md) | | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the reward was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward. | [default to 'reward'] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] | diff --git a/docs/RewardAssignment.md b/docs/RewardAssignment.md index 87aac727..e80d1329 100644 --- a/docs/RewardAssignment.md +++ b/docs/RewardAssignment.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**RewardAssignmentParameters**](RewardAssignmentParameters.md) | | [optional] | diff --git a/docs/RewardAssignmentBase.md b/docs/RewardAssignmentBase.md deleted file mode 100644 index 1e21f8c7..00000000 --- a/docs/RewardAssignmentBase.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::RewardAssignmentBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | - diff --git a/docs/RewardAssignmentParameters.md b/docs/RewardAssignmentParameters.md index 86247ea3..28c32973 100644 --- a/docs/RewardAssignmentParameters.md +++ b/docs/RewardAssignmentParameters.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **loyalty** | [**RewardAssignmentParametersLoyalty**](RewardAssignmentParametersLoyalty.md) | | [optional] | diff --git a/docs/RewardAssignmentParametersLoyalty.md b/docs/RewardAssignmentParametersLoyalty.md new file mode 100644 index 00000000..070de925 --- /dev/null +++ b/docs/RewardAssignmentParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardAssignmentParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/RewardAssignmentParametersParameters.md b/docs/RewardAssignmentParametersParameters.md deleted file mode 100644 index f10a11b1..00000000 --- a/docs/RewardAssignmentParametersParameters.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RewardAssignmentParametersParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **loyalty** | [**RewardAssignmentParametersParametersLoyalty**](RewardAssignmentParametersParametersLoyalty.md) | | | - diff --git a/docs/RewardAssignmentParametersParametersLoyalty.md b/docs/RewardAssignmentParametersParametersLoyalty.md deleted file mode 100644 index 82e306ca..00000000 --- a/docs/RewardAssignmentParametersParametersLoyalty.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RewardAssignmentParametersParametersLoyalty - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | - diff --git a/docs/RewardAssignmentsCreateCoinRewardRequestBody.md b/docs/RewardAssignmentsCreateCoinRewardRequestBody.md deleted file mode 100644 index 5dc89207..00000000 --- a/docs/RewardAssignmentsCreateCoinRewardRequestBody.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RewardAssignmentsCreateCoinRewardRequestBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **campaign** | **String** | The campaign ID of the campaign to which the reward is to be assigned. | | -| **validation_rules** | **Array<String>** | | [optional] | - diff --git a/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody.md b/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody.md deleted file mode 100644 index f5ce1df8..00000000 --- a/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **campaign** | **String** | The campaign ID of the campaign to which the reward is to be assigned. | | -| **parameters** | [**RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters**](RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters.md) | | | - diff --git a/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters.md b/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters.md deleted file mode 100644 index b2670ea6..00000000 --- a/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **loyalty** | [**RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty**](RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty.md) | | | - diff --git a/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty.md b/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty.md deleted file mode 100644 index f2cb0843..00000000 --- a/docs/RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. | [optional] | - diff --git a/docs/RewardType.md b/docs/RewardType.md index 7331b505..927c84b2 100644 --- a/docs/RewardType.md +++ b/docs/RewardType.md @@ -1,51 +1,10 @@ # VoucherifySdk::RewardType -## Class instance methods +## Properties -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RewardType.openapi_one_of -# => -# [ -# :'RewardTypeCampaign', -# :'RewardTypeCoin', -# :'RewardTypeMaterial' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RewardType.build(data) -# => # - -VoucherifySdk::RewardType.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `RewardTypeCampaign` -- `RewardTypeCoin` -- `RewardTypeMaterial` -- `nil` (if no type matches) +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign** | [**RewardTypeCampaign**](RewardTypeCampaign.md) | | [optional] | +| **coin** | [**RewardTypeCoin**](RewardTypeCoin.md) | | [optional] | +| **product** | [**RewardTypeProduct**](RewardTypeProduct.md) | | [optional] | diff --git a/docs/RewardTypeCampaign.md b/docs/RewardTypeCampaign.md index fa960e6d..408a6f8a 100644 --- a/docs/RewardTypeCampaign.md +++ b/docs/RewardTypeCampaign.md @@ -4,5 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **campaign** | [**RewardTypeCampaignCampaign**](RewardTypeCampaignCampaign.md) | | | +| **id** | **String** | Unique campaign ID, assigned by Voucherify. | [optional] | +| **balance** | **Integer** | The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card. For gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **type** | **String** | Campaign type. | [optional] | diff --git a/docs/RewardTypeCampaignCampaign.md b/docs/RewardTypeCampaignCampaign.md deleted file mode 100644 index ac099530..00000000 --- a/docs/RewardTypeCampaignCampaign.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::RewardTypeCampaignCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID, assigned by Voucherify. | | -| **balance** | **Integer** | The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | -| **type** | **String** | Campaign type. | | - diff --git a/docs/RewardTypeCoin.md b/docs/RewardTypeCoin.md index 3c36692d..6eb9bc2f 100644 --- a/docs/RewardTypeCoin.md +++ b/docs/RewardTypeCoin.md @@ -4,5 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **coin** | [**RewardTypeCoinCoin**](RewardTypeCoinCoin.md) | | | +| **exchange_ratio** | **Float** | The cash equivalent of the points defined in the points_ratio property. | [optional] | +| **points_ratio** | **Integer** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] | diff --git a/docs/RewardTypeCoinCoin.md b/docs/RewardTypeCoinCoin.md deleted file mode 100644 index 44f090f2..00000000 --- a/docs/RewardTypeCoinCoin.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RewardTypeCoinCoin - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **exchange_ratio** | **Float** | The cash equivalent of the points defined in the points_ratio property. | | -| **points_ratio** | **Integer** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] | - diff --git a/docs/RewardTypeMaterial.md b/docs/RewardTypeMaterial.md deleted file mode 100644 index 0b48e5eb..00000000 --- a/docs/RewardTypeMaterial.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::RewardTypeMaterial - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **product** | [**RewardTypeMaterialProduct**](RewardTypeMaterialProduct.md) | | | - diff --git a/docs/RewardTypeMaterialProduct.md b/docs/RewardTypeMaterialProduct.md deleted file mode 100644 index 189e9e3e..00000000 --- a/docs/RewardTypeMaterialProduct.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::RewardTypeMaterialProduct - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID, assigned by Voucherify. | | -| **sku_id** | **String** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | | - diff --git a/docs/RewardTypeProduct.md b/docs/RewardTypeProduct.md new file mode 100644 index 00000000..18f1046b --- /dev/null +++ b/docs/RewardTypeProduct.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardTypeProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique product ID, assigned by Voucherify. | [optional] | +| **sku_id** | **String** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [optional] | + diff --git a/docs/RewardsApi.md b/docs/RewardsApi.md index 90b6b155..4092c40c 100644 --- a/docs/RewardsApi.md +++ b/docs/RewardsApi.md @@ -4,14 +4,78 @@ All URIs are relative to *https://api.voucherify.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**create_reward**](RewardsApi.md#create_reward) | **POST** /v1/rewards | Create Reward | | [**create_reward_assignment**](RewardsApi.md#create_reward_assignment) | **POST** /v1/rewards/{rewardId}/assignments | Create Reward Assignment | | [**delete_reward**](RewardsApi.md#delete_reward) | **DELETE** /v1/rewards/{rewardId} | Delete Reward | | [**delete_reward_assignment**](RewardsApi.md#delete_reward_assignment) | **DELETE** /v1/rewards/{rewardId}/assignments/{assignmentId} | Delete Reward Assignment | +| [**get_reward**](RewardsApi.md#get_reward) | **GET** /v1/rewards/{rewardId} | Get Reward | | [**get_reward_assignment**](RewardsApi.md#get_reward_assignment) | **GET** /v1/rewards/{rewardId}/assignments/{assignmentId} | Get Reward Assignment | | [**list_reward_assignments**](RewardsApi.md#list_reward_assignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments | +| [**list_rewards**](RewardsApi.md#list_rewards) | **GET** /v1/rewards | List Rewards | +| [**update_reward**](RewardsApi.md#update_reward) | **PUT** /v1/rewards/{rewardId} | Update Reward | | [**update_reward_assignment**](RewardsApi.md#update_reward_assignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment | +## create_reward + +> create_reward(opts) + +Create Reward + +Create a new reward. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::RewardsApi.new +opts = { + rewards_create_request_body: VoucherifySdk::RewardsCreateRequestBody.new # RewardsCreateRequestBody | Define parameters of the new reward. +} + +begin + # Create Reward + result = api_instance.create_reward(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling RewardsApi->create_reward: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rewards_create_request_body** | [**RewardsCreateRequestBody**](RewardsCreateRequestBody.md) | Define parameters of the new reward. | [optional] | + +### Return type + +[**RewardsCreateResponseBody**](RewardsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## create_reward_assignment > create_reward_assignment(reward_id, opts) @@ -41,7 +105,7 @@ end api_instance = VoucherifySdk::RewardsApi.new reward_id = 'reward_id_example' # String | A unique reward ID. opts = { - rewards_assignments_create_request_body: VoucherifySdk::RewardAssignmentsCreateCoinRewardRequestBody.new({campaign: 'campaign_example'}) # RewardsAssignmentsCreateRequestBody | Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. + rewards_assignments_create_request_body: VoucherifySdk::RewardsAssignmentsCreateRequestBody.new # RewardsAssignmentsCreateRequestBody | Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. } begin @@ -190,6 +254,64 @@ nil (empty response body) - **Accept**: Not defined +## get_reward + +> get_reward(reward_id) + +Get Reward + +Retrieve a reward by the reward ID. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::RewardsApi.new +reward_id = 'reward_id_example' # String | A unique reward ID. + +begin + # Get Reward + result = api_instance.get_reward(reward_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling RewardsApi->get_reward: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reward_id** | **String** | A unique reward ID. | | + +### Return type + +[**Reward**](Reward.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## get_reward_assignment > get_reward_assignment(reward_id, assignment_id) @@ -279,8 +401,8 @@ end api_instance = VoucherifySdk::RewardsApi.new reward_id = 'reward_id_example' # String | A unique reward ID. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56 # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56 # Integer | Which page of results to return. The lowest value is 1. } begin @@ -297,8 +419,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **reward_id** | **String** | A unique reward ID. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | ### Return type @@ -314,6 +436,132 @@ end - **Accept**: application/json +## list_rewards + +> list_rewards(opts) + +List Rewards + +Retrieve rewards. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::RewardsApi.new +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + assignment_id: 'assignment_id_example' # String | A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. +} + +begin + # List Rewards + result = api_instance.list_rewards(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling RewardsApi->list_rewards: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **assignment_id** | **String** | A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. | [optional] | + +### Return type + +[**RewardsListResponseBody**](RewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## update_reward + +> update_reward(reward_id, opts) + +Update Reward + +Update the details of a reward. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::RewardsApi.new +reward_id = 'reward_id_example' # String | A unique reward ID. +opts = { + rewards_update_request_body: VoucherifySdk::RewardsUpdateRequestBody.new # RewardsUpdateRequestBody | Define the parameters to be updated for the reward. +} + +begin + # Update Reward + result = api_instance.update_reward(reward_id, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling RewardsApi->update_reward: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reward_id** | **String** | A unique reward ID. | | +| **rewards_update_request_body** | [**RewardsUpdateRequestBody**](RewardsUpdateRequestBody.md) | Define the parameters to be updated for the reward. | [optional] | + +### Return type + +[**RewardsUpdateResponseBody**](RewardsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## update_reward_assignment > update_reward_assignment(reward_id, assignment_id, opts) diff --git a/docs/RewardsAssignmentsCreateRequestBody.md b/docs/RewardsAssignmentsCreateRequestBody.md index f8a5d853..a5bcb24c 100644 --- a/docs/RewardsAssignmentsCreateRequestBody.md +++ b/docs/RewardsAssignmentsCreateRequestBody.md @@ -1,49 +1,10 @@ # VoucherifySdk::RewardsAssignmentsCreateRequestBody -## Class instance methods +## Properties -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RewardsAssignmentsCreateRequestBody.openapi_one_of -# => -# [ -# :'RewardAssignmentsCreateCoinRewardRequestBody', -# :'RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::RewardsAssignmentsCreateRequestBody.build(data) -# => # - -VoucherifySdk::RewardsAssignmentsCreateRequestBody.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `RewardAssignmentsCreateCoinRewardRequestBody` -- `RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody` -- `nil` (if no type matches) +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign** | **String** | The campaign ID of the campaign to which the reward is to be assigned. | [optional] | +| **parameters** | [**RewardsAssignmentsCreateRequestBodyParameters**](RewardsAssignmentsCreateRequestBodyParameters.md) | | [optional] | +| **validation_rules** | **Array<String>** | | [optional] | diff --git a/docs/RewardsAssignmentsCreateRequestBodyParameters.md b/docs/RewardsAssignmentsCreateRequestBodyParameters.md new file mode 100644 index 00000000..f96ee70d --- /dev/null +++ b/docs/RewardsAssignmentsCreateRequestBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsCreateRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**RewardsAssignmentsCreateRequestBodyParametersLoyalty**](RewardsAssignmentsCreateRequestBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md b/docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..2d091b1f --- /dev/null +++ b/docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsCreateRequestBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer. | [optional] | + diff --git a/docs/RewardsAssignmentsCreateResponseBody.md b/docs/RewardsAssignmentsCreateResponseBody.md index 7dbe8ec9..179de83d 100644 --- a/docs/RewardsAssignmentsCreateResponseBody.md +++ b/docs/RewardsAssignmentsCreateResponseBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**RewardsAssignmentsCreateResponseBodyParameters**](RewardsAssignmentsCreateResponseBodyParameters.md) | | [optional] | diff --git a/docs/RewardsAssignmentsCreateResponseBodyParameters.md b/docs/RewardsAssignmentsCreateResponseBodyParameters.md new file mode 100644 index 00000000..395587eb --- /dev/null +++ b/docs/RewardsAssignmentsCreateResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsCreateResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**RewardsAssignmentsCreateResponseBodyParametersLoyalty**](RewardsAssignmentsCreateResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md b/docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..658a7689 --- /dev/null +++ b/docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsCreateResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/RewardsAssignmentsGetResponseBody.md b/docs/RewardsAssignmentsGetResponseBody.md index 0ba67df1..e7eb2989 100644 --- a/docs/RewardsAssignmentsGetResponseBody.md +++ b/docs/RewardsAssignmentsGetResponseBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**RewardsAssignmentsGetResponseBodyParameters**](RewardsAssignmentsGetResponseBodyParameters.md) | | [optional] | diff --git a/docs/RewardsAssignmentsGetResponseBodyParameters.md b/docs/RewardsAssignmentsGetResponseBodyParameters.md new file mode 100644 index 00000000..b6d528c5 --- /dev/null +++ b/docs/RewardsAssignmentsGetResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsGetResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**RewardsAssignmentsGetResponseBodyParametersLoyalty**](RewardsAssignmentsGetResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md b/docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..14e703df --- /dev/null +++ b/docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsGetResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/RewardsAssignmentsListResponseBody.md b/docs/RewardsAssignmentsListResponseBody.md index 9adaa975..7d5e5848 100644 --- a/docs/RewardsAssignmentsListResponseBody.md +++ b/docs/RewardsAssignmentsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about reward assignments in a dictionary. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of reward assignments. | [default to 'data'] | -| **data** | [**Array<RewardAssignment>**](RewardAssignment.md) | | | -| **total** | **Integer** | Total number of reward assignments. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about reward assignments in a dictionary. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of reward assignments. | [optional][default to 'data'] | +| **data** | [**Array<RewardAssignment>**](RewardAssignment.md) | | [optional] | +| **total** | **Integer** | Total number of reward assignments. | [optional] | diff --git a/docs/RewardsAssignmentsUpdateResponseBody.md b/docs/RewardsAssignmentsUpdateResponseBody.md index c3fd79d2..b9fee86f 100644 --- a/docs/RewardsAssignmentsUpdateResponseBody.md +++ b/docs/RewardsAssignmentsUpdateResponseBody.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | | -| **reward_id** | **String** | Associated reward ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward assignment. | [default to 'reward_assignment'] | -| **related_object_id** | **String** | Related object ID to which the reward was assigned. | | -| **related_object_type** | **String** | Related object type to which the reward was assigned. | [default to 'campaign'] | -| **parameters** | [**RewardAssignmentParametersParameters**](RewardAssignmentParametersParameters.md) | | [optional] | +| **id** | **String** | Unique reward assignment ID, assigned by Voucherify. | [optional] | +| **reward_id** | **String** | Associated reward ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional][default to 'reward_assignment'] | +| **related_object_id** | **String** | Related object ID to which the reward was assigned. | [optional] | +| **related_object_type** | **String** | Related object type to which the reward was assigned. | [optional][default to 'campaign'] | +| **parameters** | [**RewardsAssignmentsUpdateResponseBodyParameters**](RewardsAssignmentsUpdateResponseBodyParameters.md) | | [optional] | diff --git a/docs/RewardsAssignmentsUpdateResponseBodyParameters.md b/docs/RewardsAssignmentsUpdateResponseBodyParameters.md new file mode 100644 index 00000000..b333eddb --- /dev/null +++ b/docs/RewardsAssignmentsUpdateResponseBodyParameters.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsUpdateResponseBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **loyalty** | [**RewardsAssignmentsUpdateResponseBodyParametersLoyalty**](RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md) | | [optional] | + diff --git a/docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md b/docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..47bc67be --- /dev/null +++ b/docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md @@ -0,0 +1,8 @@ +# VoucherifySdk::RewardsAssignmentsUpdateResponseBodyParametersLoyalty + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | The number of points required to redeem the reward. | [optional] | + diff --git a/docs/RewardsCreateRequestBody.md b/docs/RewardsCreateRequestBody.md new file mode 100644 index 00000000..f788416e --- /dev/null +++ b/docs/RewardsCreateRequestBody.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RewardsCreateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Reward name. | [optional] | +| **parameters** | [**RewardsCreateRequestBodyParameters**](RewardsCreateRequestBodyParameters.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **stock** | **Integer** | The number of units of the product that you want to share as a reward. | [optional] | +| **attributes** | [**RewardsCreateRequestBodyAttributes**](RewardsCreateRequestBodyAttributes.md) | | [optional] | + diff --git a/docs/RewardsCreateRequestBodyAttributes.md b/docs/RewardsCreateRequestBodyAttributes.md new file mode 100644 index 00000000..4a03b3f2 --- /dev/null +++ b/docs/RewardsCreateRequestBodyAttributes.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsCreateRequestBodyAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | HTTPS URL pointing to a .png or .jpg file. | [optional] | +| **description** | **String** | Description of a material reward. | [optional] | + diff --git a/docs/RewardsCreateRequestBodyParameters.md b/docs/RewardsCreateRequestBodyParameters.md new file mode 100644 index 00000000..fc428cbe --- /dev/null +++ b/docs/RewardsCreateRequestBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RewardsCreateRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign** | [**RewardsCreateRequestBodyParametersCampaign**](RewardsCreateRequestBodyParametersCampaign.md) | | [optional] | +| **product** | [**RewardsCreateRequestBodyParametersProduct**](RewardsCreateRequestBodyParametersProduct.md) | | [optional] | +| **coin** | [**RewardsCreateRequestBodyParametersCoin**](RewardsCreateRequestBodyParametersCoin.md) | | [optional] | + diff --git a/docs/RewardsCreateRequestBodyParametersCampaign.md b/docs/RewardsCreateRequestBodyParametersCampaign.md new file mode 100644 index 00000000..141c44e1 --- /dev/null +++ b/docs/RewardsCreateRequestBodyParametersCampaign.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsCreateRequestBodyParametersCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **balance** | **Integer** | The incremental points to be added to the current balance on the loyalty card. and The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | + diff --git a/docs/RewardsCreateRequestBodyParametersCoin.md b/docs/RewardsCreateRequestBodyParametersCoin.md new file mode 100644 index 00000000..4895b967 --- /dev/null +++ b/docs/RewardsCreateRequestBodyParametersCoin.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsCreateRequestBodyParametersCoin + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **exchange_ratio** | **String** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] | +| **points_ratio** | **String** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] | + diff --git a/docs/RewardsCreateRequestBodyParametersProduct.md b/docs/RewardsCreateRequestBodyParametersProduct.md new file mode 100644 index 00000000..bb096402 --- /dev/null +++ b/docs/RewardsCreateRequestBodyParametersProduct.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsCreateRequestBodyParametersProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique product ID, assigned by Voucherify, given as a reward. | [optional] | +| **sku_id** | **String** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [optional] | + diff --git a/docs/RewardsCreateResponseBody.md b/docs/RewardsCreateResponseBody.md new file mode 100644 index 00000000..8aadfb2d --- /dev/null +++ b/docs/RewardsCreateResponseBody.md @@ -0,0 +1,18 @@ +# VoucherifySdk::RewardsCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Reward name. | [optional] | +| **stock** | **Integer** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] | +| **redeemed** | **Integer** | Defines the number of already invoked (successful) reward redemptions. | [optional] | +| **attributes** | [**RewardsCreateResponseBodyAttributes**](RewardsCreateResponseBodyAttributes.md) | | [optional] | +| **metadata** | **Object** | 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. | [optional] | +| **type** | **String** | Reward type. | [optional] | +| **parameters** | [**RewardType**](RewardType.md) | | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] | + diff --git a/docs/RewardsCreateResponseBodyAttributes.md b/docs/RewardsCreateResponseBodyAttributes.md new file mode 100644 index 00000000..3f14dcf5 --- /dev/null +++ b/docs/RewardsCreateResponseBodyAttributes.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsCreateResponseBodyAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file. | [optional] | +| **description** | **String** | An arbitrary string that you can attach to a material reward. | [optional] | + diff --git a/docs/RewardsListResponseBody.md b/docs/RewardsListResponseBody.md new file mode 100644 index 00000000..fbd78406 --- /dev/null +++ b/docs/RewardsListResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::RewardsListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of transaction objects. | [optional][default to 'data'] | +| **data** | [**Array<Reward>**](Reward.md) | A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object. | [optional] | +| **total** | **Integer** | Returns how many rewards in the project meet the limits defined by the query parameter definitions. | [optional] | + diff --git a/docs/RewardsUpdateRequestBody.md b/docs/RewardsUpdateRequestBody.md new file mode 100644 index 00000000..a2effeb6 --- /dev/null +++ b/docs/RewardsUpdateRequestBody.md @@ -0,0 +1,12 @@ +# VoucherifySdk::RewardsUpdateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Reward name. | [optional] | +| **parameters** | [**RewardsUpdateRequestBodyParameters**](RewardsUpdateRequestBodyParameters.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **stock** | **Integer** | The number of units of the product that you want to share as a reward. | [optional] | +| **attributes** | [**RewardsUpdateRequestBodyAttributes**](RewardsUpdateRequestBodyAttributes.md) | | [optional] | + diff --git a/docs/RewardsUpdateRequestBodyAttributes.md b/docs/RewardsUpdateRequestBodyAttributes.md new file mode 100644 index 00000000..827f6fd1 --- /dev/null +++ b/docs/RewardsUpdateRequestBodyAttributes.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsUpdateRequestBodyAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | HTTPS URL pointing to a .png or .jpg file. | [optional] | +| **description** | **String** | Description of a material reward. | [optional] | + diff --git a/docs/RewardsUpdateRequestBodyParameters.md b/docs/RewardsUpdateRequestBodyParameters.md new file mode 100644 index 00000000..09e1a5b3 --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParameters.md @@ -0,0 +1,10 @@ +# VoucherifySdk::RewardsUpdateRequestBodyParameters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign** | [**RewardsUpdateRequestBodyParametersCampaign**](RewardsUpdateRequestBodyParametersCampaign.md) | | [optional] | +| **product** | [**RewardsUpdateRequestBodyParametersProduct**](RewardsUpdateRequestBodyParametersProduct.md) | | [optional] | +| **coin** | [**RewardsUpdateRequestBodyParametersCoin**](RewardsUpdateRequestBodyParametersCoin.md) | | [optional] | + diff --git a/docs/RewardsUpdateRequestBodyParametersCampaign.md b/docs/RewardsUpdateRequestBodyParametersCampaign.md new file mode 100644 index 00000000..3707178b --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParametersCampaign.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsUpdateRequestBodyParametersCampaign + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **balance** | **Integer** | The incremental points to be added to the current balance on the loyalty card. and The incremental amount to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | + diff --git a/docs/RewardsUpdateRequestBodyParametersCoin.md b/docs/RewardsUpdateRequestBodyParametersCoin.md new file mode 100644 index 00000000..88bb1a94 --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParametersCoin.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsUpdateRequestBodyParametersCoin + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **exchange_ratio** | **String** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] | +| **points_ratio** | **String** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] | + diff --git a/docs/RewardsUpdateRequestBodyParametersProduct.md b/docs/RewardsUpdateRequestBodyParametersProduct.md new file mode 100644 index 00000000..12d6874e --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParametersProduct.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsUpdateRequestBodyParametersProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique product ID, assigned by Voucherify, given as a reward. | [optional] | +| **sku_id** | **String** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [optional] | + diff --git a/docs/RewardsUpdateResponseBody.md b/docs/RewardsUpdateResponseBody.md new file mode 100644 index 00000000..25f722bc --- /dev/null +++ b/docs/RewardsUpdateResponseBody.md @@ -0,0 +1,18 @@ +# VoucherifySdk::RewardsUpdateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID, assigned by Voucherify. | [optional] | +| **name** | **String** | Reward name. | [optional] | +| **stock** | **Integer** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] | +| **redeemed** | **Integer** | Defines the number of already invoked (successful) reward redemptions. | [optional] | +| **attributes** | [**RewardsUpdateResponseBodyAttributes**](RewardsUpdateResponseBodyAttributes.md) | | [optional] | +| **metadata** | **Object** | 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. | [optional] | +| **type** | **String** | Reward type. | [optional] | +| **parameters** | [**RewardType**](RewardType.md) | | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] | + diff --git a/docs/RewardsUpdateResponseBodyAttributes.md b/docs/RewardsUpdateResponseBodyAttributes.md new file mode 100644 index 00000000..76312bb6 --- /dev/null +++ b/docs/RewardsUpdateResponseBodyAttributes.md @@ -0,0 +1,9 @@ +# VoucherifySdk::RewardsUpdateResponseBodyAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file. | [optional] | +| **description** | **String** | An arbitrary string that you can attach to a material reward. | [optional] | + diff --git a/docs/SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion.md b/docs/SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion.md deleted file mode 100644 index f60a996b..00000000 --- a/docs/SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **tiers** | [**Array<PromotionTierCreateParams>**](PromotionTierCreateParams.md) | | [optional] | - diff --git a/docs/SegmentsApi.md b/docs/SegmentsApi.md index d0810bab..3e14ba5b 100644 --- a/docs/SegmentsApi.md +++ b/docs/SegmentsApi.md @@ -4,7 +4,69 @@ All URIs are relative to *https://api.voucherify.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**create_segment**](SegmentsApi.md#create_segment) | **POST** /v1/segments | Create Segment | | [**delete_segment**](SegmentsApi.md#delete_segment) | **DELETE** /v1/segments/{segmentId} | Delete Segment | +| [**get_segment**](SegmentsApi.md#get_segment) | **GET** /v1/segments/{segmentId} | Get Segment | + + +## create_segment + +> create_segment(opts) + +Create Segment + +Create a customer segment. 🚧 Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::SegmentsApi.new +opts = { + segments_create_request_body: VoucherifySdk::SegmentsCreateRequestBody.new # SegmentsCreateRequestBody | Specify the boundary conditions for the customer segment. +} + +begin + # Create Segment + result = api_instance.create_segment(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling SegmentsApi->create_segment: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **segments_create_request_body** | [**SegmentsCreateRequestBody**](SegmentsCreateRequestBody.md) | Specify the boundary conditions for the customer segment. | [optional] | + +### Return type + +[**SegmentsCreateResponseBody**](SegmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json ## delete_segment @@ -63,3 +125,61 @@ nil (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined + +## get_segment + +> get_segment(segment_id) + +Get Segment + +Retrieves the segment with given segment ID. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::SegmentsApi.new +segment_id = 'segment_id_example' # String | A unique customer segment ID. + +begin + # Get Segment + result = api_instance.get_segment(segment_id) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling SegmentsApi->get_segment: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **segment_id** | **String** | A unique customer segment ID. | | + +### Return type + +[**SegmentsGetResponseBody**](SegmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/SegmentsCreateRequestBody.md b/docs/SegmentsCreateRequestBody.md new file mode 100644 index 00000000..21355036 --- /dev/null +++ b/docs/SegmentsCreateRequestBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::SegmentsCreateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Segment name. | [optional] | +| **type** | **String** | | [optional] | +| **customers** | **Array<String>** | Array of customer IDs. | [optional] | +| **filter** | **Object** | Defines a set of criteria for an `auto-update` segment type. | [optional] | + diff --git a/docs/SegmentsCreateResponseBody.md b/docs/SegmentsCreateResponseBody.md new file mode 100644 index 00000000..09f7b5bb --- /dev/null +++ b/docs/SegmentsCreateResponseBody.md @@ -0,0 +1,14 @@ +# VoucherifySdk::SegmentsCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique segment ID. | [optional] | +| **name** | **String** | Segment name. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. | [optional] | +| **type** | **String** | Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). | [optional] | +| **filter** | **Object** | Defines a set of criteria for an `auto-update` segment type. | [optional] | +| **initial_sync_status** | **String** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the customer segment. | [optional][default to 'segment'] | + diff --git a/docs/SegmentsGetResponseBody.md b/docs/SegmentsGetResponseBody.md new file mode 100644 index 00000000..cc3b468d --- /dev/null +++ b/docs/SegmentsGetResponseBody.md @@ -0,0 +1,14 @@ +# VoucherifySdk::SegmentsGetResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique segment ID. | [optional] | +| **name** | **String** | Segment name. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. | [optional] | +| **type** | **String** | Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). | [optional] | +| **filter** | **Object** | Defines a set of criteria for an `auto-update` segment type. | [optional] | +| **initial_sync_status** | **String** | | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the customer segment. | [optional][default to 'segment'] | + diff --git a/docs/Session.md b/docs/Session.md index b94c5181..ff686600 100644 --- a/docs/Session.md +++ b/docs/Session.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **key** | **String** | The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. | [optional][default to 'LOCK'] | -| **type** | **String** | This parameter is required to establish a new session. The session locks the redemption quantity by 1. | [optional][default to 'LOCK'] | +| **key** | **String** | The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. | [optional] | +| **type** | **String** | This parameter is required to establish a new session. | [optional][default to 'LOCK'] | | **ttl** | **Float** | Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter. | [optional] | | **ttl_unit** | **String** | Defines the type of unit in which the session time is counted. | [optional] | diff --git a/docs/SimpleCampaign.md b/docs/SimpleCampaign.md deleted file mode 100644 index 9753bc02..00000000 --- a/docs/SimpleCampaign.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::SimpleCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Campaign name. | [optional] | -| **name** | **String** | Campaign name. | [optional] | -| **campaign_type** | **String** | Type of campaign. | [optional] | -| **type** | **String** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] | -| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **voucher** | **Object** | | [optional] | -| **lucky_draw** | **Object** | | [optional] | -| **referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] | -| **auto_join** | **Boolean** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] | -| **join_once** | **Boolean** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] | -| **active** | **Boolean** | Indicates whether campaign is active | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the campaign was created in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the campaign. | [optional][default to 'campaign'] | - diff --git a/docs/SimpleConsent.md b/docs/SimpleConsent.md deleted file mode 100644 index 909db8d4..00000000 --- a/docs/SimpleConsent.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::SimpleConsent - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | | [optional] | -| **name** | **String** | | [optional] | -| **object** | **String** | | [default to 'consent'] | - diff --git a/docs/SimpleCustomer.md b/docs/SimpleCustomer.md index c52a3687..5162e3f6 100644 --- a/docs/SimpleCustomer.md +++ b/docs/SimpleCustomer.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | The ID of an existing customer that will be linked to redemption in this request. | [optional] | -| **source_id** | **String** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] | +| **id** | **String** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] | | **name** | **String** | Customer's first and last name. | [optional] | | **email** | **String** | Customer's email address. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | -| **object** | **String** | The type of object represented by JSON. | [optional][default to 'customer'] | +| **source_id** | **String** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that are attached to the customer. It stores all custom attributes assigned to the customer. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'customer'] | diff --git a/docs/SimpleCustomerRequiredObjectType.md b/docs/SimpleCustomerRequiredObjectType.md index 49adcd4e..d81d0aba 100644 --- a/docs/SimpleCustomerRequiredObjectType.md +++ b/docs/SimpleCustomerRequiredObjectType.md @@ -5,9 +5,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The unique ID of a customer that is assigned by Voucherify. | [optional] | -| **source_id** | **String** | The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. | [optional] | +| **source_id** | **String** | The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. | [optional] | | **name** | **String** | Customer's first and last name. | [optional] | | **email** | **String** | Customer's email address. | [optional] | | **metadata** | **Object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the customer. | [default to 'customer'] | +| **object** | **String** | The type of the object represented by the JSON. This object stores information about the customer. | [optional][default to 'customer'] | diff --git a/docs/SimpleLoyaltyCard.md b/docs/SimpleLoyaltyCard.md new file mode 100644 index 00000000..c8dde1fb --- /dev/null +++ b/docs/SimpleLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::SimpleLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **String** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/SimpleOrder.md b/docs/SimpleOrder.md deleted file mode 100644 index f7abc0eb..00000000 --- a/docs/SimpleOrder.md +++ /dev/null @@ -1,23 +0,0 @@ -# VoucherifySdk::SimpleOrder - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] | -| **source_id** | **String** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] | -| **status** | **String** | The order status. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **discount_amount** | **Integer** | Sum of all order-level discounts applied to the order. | [optional] | -| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | -| **items_discount_amount** | **Integer** | Sum of all product-specific discounts applied to the order. | [optional] | -| **items_applied_discount_amount** | **Integer** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] | -| **total_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] | -| **total_applied_discount_amount** | **Integer** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] | -| **total_amount** | **Integer** | Order amount after undoing all the discounts through the rollback redemption. | [optional] | -| **items** | [**Array<SimpleOrderItem>**](SimpleOrderItem.md) | Array of items applied to the order. | [optional] | -| **metadata** | **Object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] | -| **object** | **String** | The type of object represented by JSON. | [default to 'order'] | - diff --git a/docs/SimpleOrderItem.md b/docs/SimpleOrderItem.md deleted file mode 100644 index bb6342a6..00000000 --- a/docs/SimpleOrderItem.md +++ /dev/null @@ -1,18 +0,0 @@ -# VoucherifySdk::SimpleOrderItem - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `order_item`. | [optional][default to 'order_item'] | -| **source_id** | **String** | The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] | -| **related_object** | **String** | Used along with the source_id property, can be set to either sku or product. | [optional] | -| **product_id** | **String** | A unique product ID assigned by Voucherify. | [optional] | -| **sku_id** | **String** | A unique SKU ID assigned by Voucherify. | [optional] | -| **quantity** | **Integer** | The quantity of the particular item in the cart. | [optional] | -| **discount_quantity** | **Integer** | Number of dicounted items. | [optional] | -| **amount** | **Integer** | The total amount of the order item (price * quantity). | [optional] | -| **discount_amount** | **Integer** | Sum of all order-item-level discounts applied to the order. | [optional] | -| **applied_discount_amount** | **Integer** | This field shows the order-level discount applied. | [optional] | -| **price** | **Integer** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | - diff --git a/docs/SimpleProduct.md b/docs/SimpleProduct.md deleted file mode 100644 index 7e28a255..00000000 --- a/docs/SimpleProduct.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::SimpleProduct - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID. | [optional] | -| **source_id** | **String** | Product source id. | [optional] | -| **name** | **String** | Product name. | [optional] | - diff --git a/docs/SimpleProductDiscountUnit.md b/docs/SimpleProductDiscountUnit.md index bae147dc..2ed80d33 100644 --- a/docs/SimpleProductDiscountUnit.md +++ b/docs/SimpleProductDiscountUnit.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique product ID, assigned by Voucherify. | | +| **id** | **String** | Unique product ID, assigned by Voucherify. | [optional] | | **source_id** | **String** | Product's source ID. | [optional] | -| **name** | **String** | Product name. | | +| **name** | **String** | Product name. | [optional] | diff --git a/docs/SimplePromotionTier.md b/docs/SimplePromotionTier.md deleted file mode 100644 index 9509f9dc..00000000 --- a/docs/SimplePromotionTier.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::SimplePromotionTier - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique promotion tier ID. | [optional] | -| **name** | **String** | Name of the promotion tier. | [optional] | -| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | -| **campaign** | [**SimplePromotionTierCampaign**](SimplePromotionTierCampaign.md) | | [optional] | - diff --git a/docs/SimplePromotionTierCampaign.md b/docs/SimplePromotionTierCampaign.md deleted file mode 100644 index d8de02bd..00000000 --- a/docs/SimplePromotionTierCampaign.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::SimplePromotionTierCampaign - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique campaign ID. | [optional] | - diff --git a/docs/SimpleRedemption.md b/docs/SimpleRedemption.md deleted file mode 100644 index 1648207e..00000000 --- a/docs/SimpleRedemption.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::SimpleRedemption - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | [optional] | -| **customer_id** | **String** | Unique customer ID of the redeeming customer. | [optional] | -| **tracking_id** | **String** | Hashed customer source ID. | [optional] | -| **date** | **Time** | Timestamp representing the date and time when the redemption was created in ISO 8601 format. | [optional] | -| **amount** | **Integer** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] | -| **order** | [**SimpleOrder**](SimpleOrder.md) | | [optional] | -| **reward** | [**SimpleRedemptionRewardResult**](SimpleRedemptionRewardResult.md) | | [optional] | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **result** | **String** | Redemption result. | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **promotion_tier** | [**SimplePromotionTier**](SimplePromotionTier.md) | | [optional] | -| **redemption** | **String** | Unique redemption ID of the parent redemption. | [optional] | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the `redemption`. | [optional][default to 'redemption'] | - diff --git a/docs/SimpleRedemptionRewardResult.md b/docs/SimpleRedemptionRewardResult.md deleted file mode 100644 index 661fc2fc..00000000 --- a/docs/SimpleRedemptionRewardResult.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::SimpleRedemptionRewardResult - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **assignment_id** | **String** | Unique reward assignment ID assigned by Voucherify. | [optional] | -| **voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] | -| **product** | [**SimpleProduct**](SimpleProduct.md) | | [optional] | -| **sku** | [**SimpleSku**](SimpleSku.md) | | [optional] | -| **loyalty_tier_id** | **String** | Unique loyalty tier ID assigned by Voucherify. | [optional] | -| **id** | **String** | Unique reward ID, assigned by Voucherify. | [optional] | -| **object** | **String** | The type of object represented by the JSON. This object stores information about the reward. | [optional][default to 'reward'] | -| **name** | **String** | Reward name. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the reward was created in ISO 8601 format. | [optional] | -| **updated_at** | **Time** | Timestamp representing the date and time when the reward was updated in ISO 8601 format. | [optional] | -| **parameters** | **Object** | Defines how the reward is generated. | [optional] | -| **type** | **String** | Reward type. | [optional] | - diff --git a/docs/SimpleReferralTier.md b/docs/SimpleReferralTier.md deleted file mode 100644 index 3369883a..00000000 --- a/docs/SimpleReferralTier.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::SimpleReferralTier - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique referral tier ID. | [optional] | -| **campaign_id** | **String** | Campaign Id. | [optional] | -| **banner** | **String** | Text to be displayed to your customers on your website. | [optional] | -| **parameters** | **Object** | Referral tier parameters | [optional] | - diff --git a/docs/SimpleSegment.md b/docs/SimpleSegment.md index a2ee0464..5c75ed65 100644 --- a/docs/SimpleSegment.md +++ b/docs/SimpleSegment.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique segment ID. | | -| **name** | **String** | Segment name. | | -| **object** | **String** | The type of object represented by the ID. | [default to 'segment'] | +| **id** | **String** | Unique segment ID. | [optional] | +| **name** | **String** | Segment name. | [optional] | +| **object** | **String** | The type of the object represented by the ID. | [optional][default to 'segment'] | diff --git a/docs/SimpleSku.md b/docs/SimpleSku.md deleted file mode 100644 index a548e646..00000000 --- a/docs/SimpleSku.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::SimpleSku - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique sku ID. | [optional] | -| **source_id** | **String** | Sku source id. | [optional] | -| **sku** | **String** | Sku name. | [optional] | - diff --git a/docs/SimpleSkuDiscountUnit.md b/docs/SimpleSkuDiscountUnit.md index fedaeb79..2901a246 100644 --- a/docs/SimpleSkuDiscountUnit.md +++ b/docs/SimpleSkuDiscountUnit.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique SKU ID, assigned by Voucherify. | | +| **id** | **String** | Unique SKU ID, assigned by Voucherify. | [optional] | | **source_id** | **String** | Product variant's source ID. | [optional] | -| **name** | **String** | Sku name | | +| **name** | **String** | Sku name | [optional] | diff --git a/docs/SimpleVoucher.md b/docs/SimpleVoucher.md index 633405e5..71f670b2 100644 --- a/docs/SimpleVoucher.md +++ b/docs/SimpleVoucher.md @@ -5,16 +5,24 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | A unique identifier that represents the voucher assigned by Voucherify. | [optional] | -| **code** | **String** | Voucher code. | | +| **code** | **String** | Voucher code. | [optional] | | **gift** | [**Gift**](Gift.md) | | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | -| **loyalty_card** | **Object** | Defines the loyalty card details. | [optional] | -| **type** | **String** | Type of the object. | [optional][default to 'voucher'] | -| **campaign** | **Object** | Campaign object | [optional] | +| **loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] | +| **type** | **String** | Type of the voucher. | [optional] | +| **campaign** | **String** | Campaign name. | [optional] | | **campaign_id** | **String** | Campaign unique ID. | [optional] | | **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **holder_id** | **String** | Unique customer ID of campaign owner. | [optional] | -| **referrer_id** | **String** | Unique referrer ID. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] | -| **object** | **String** | The type of object represented by JSON. | [optional][default to 'voucher'] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referrer assigned by Voucherify. | [optional] | +| **category_id** | **String** | Unique identifier of the category that this voucher belongs to. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **active** | **Boolean** | Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the order was created in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] | +| **redemption** | [**SimpleVoucherRedemption**](SimpleVoucherRedemption.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **metadata** | **Object** | A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher. | [optional] | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'voucher'] | diff --git a/docs/SimpleVoucherRedemption.md b/docs/SimpleVoucherRedemption.md new file mode 100644 index 00000000..2749c087 --- /dev/null +++ b/docs/SimpleVoucherRedemption.md @@ -0,0 +1,9 @@ +# VoucherifySdk::SimpleVoucherRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | + diff --git a/docs/Sku.md b/docs/Sku.md index 028d0a6b..d5cb7ba6 100644 --- a/docs/Sku.md +++ b/docs/Sku.md @@ -4,16 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | | -| **source_id** | **String** | A unique SKU identifier from your inventory system. | | -| **product_id** | **String** | The parent product's unique ID. | | -| **sku** | **String** | Unique user-defined SKU name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | +| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] | +| **source_id** | **String** | A unique SKU identifier from your inventory system. | [optional] | +| **product_id** | **String** | The parent product's unique ID. | [optional] | +| **sku** | **String** | Unique user-defined SKU name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | | **currency** | **String** | SKU price currency. | [optional] | -| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `SKU`. | [default to 'sku'] | +| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional][default to 'sku'] | diff --git a/docs/SkuWithProduct.md b/docs/SkuWithProduct.md deleted file mode 100644 index bc32419c..00000000 --- a/docs/SkuWithProduct.md +++ /dev/null @@ -1,20 +0,0 @@ -# VoucherifySdk::SkuWithProduct - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | | -| **source_id** | **String** | A unique SKU identifier from your inventory system. | | -| **product_id** | **String** | The parent product's unique ID. | | -| **sku** | **String** | Unique user-defined SKU name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | -| **currency** | **String** | SKU price currency. | [optional] | -| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `SKU`. | [default to 'sku'] | -| **product** | [**ProductWithoutSkus**](ProductWithoutSkus.md) | | [optional] | - diff --git a/docs/SkusGetResponseBody.md b/docs/SkusGetResponseBody.md index 0ba156fc..75e2e39b 100644 --- a/docs/SkusGetResponseBody.md +++ b/docs/SkusGetResponseBody.md @@ -4,16 +4,16 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | | -| **source_id** | **String** | A unique SKU identifier from your inventory system. | | -| **product_id** | **String** | The parent product's unique ID. | | -| **sku** | **String** | Unique user-defined SKU name. | | -| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | | +| **id** | **String** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] | +| **source_id** | **String** | A unique SKU identifier from your inventory system. | [optional] | +| **product_id** | **String** | The parent product's unique ID. | [optional] | +| **sku** | **String** | Unique user-defined SKU name. | [optional] | +| **price** | **Integer** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] | | **currency** | **String** | SKU price currency. | [optional] | -| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | | -| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | | -| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | | -| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated in ISO 8601 format. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about the `SKU`. | [default to 'sku'] | +| **attributes** | **Object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] | +| **image_url** | **String** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional][default to 'sku'] | diff --git a/docs/SkusImportCsvCreateResponseBody.md b/docs/SkusImportCsvCreateResponseBody.md index ece40a93..d26ac239 100644 --- a/docs/SkusImportCsvCreateResponseBody.md +++ b/docs/SkusImportCsvCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/SkusList.md b/docs/SkusList.md deleted file mode 100644 index 526e6c8a..00000000 --- a/docs/SkusList.md +++ /dev/null @@ -1,11 +0,0 @@ -# VoucherifySdk::SkusList - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about SKUs. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of SKUs. | [default to 'data'] | -| **skus** | [**Array<Sku>**](Sku.md) | A dictionary that contains an array of SKUs. | | -| **total** | **Integer** | Total number of SKUs in the product. | | - diff --git a/docs/SkusListForProduct.md b/docs/SkusListForProduct.md index 081d6476..f0394238 100644 --- a/docs/SkusListForProduct.md +++ b/docs/SkusListForProduct.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about SKUs. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of SKUs. | [default to 'data'] | -| **data** | [**Array<Sku>**](Sku.md) | A dictionary that contains an array of SKUs. | | -| **total** | **Integer** | Total number of SKUs in the product. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about SKUs. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of SKUs. | [optional][default to 'data'] | +| **data** | [**Array<Sku>**](Sku.md) | A dictionary that contains an array of SKUs. | [optional] | +| **total** | **Integer** | Total number of SKUs in the product. | [optional] | diff --git a/docs/StackableDiscountsApi.md b/docs/StackableDiscountsApi.md deleted file mode 100644 index 309a3314..00000000 --- a/docs/StackableDiscountsApi.md +++ /dev/null @@ -1,412 +0,0 @@ -# VoucherifySdk::StackableDiscountsApi - -All URIs are relative to *https://api.voucherify.io* - -| Method | HTTP request | Description | -| ------ | ------------ | ----------- | -| [**redeem_stacked_discounts**](StackableDiscountsApi.md#redeem_stacked_discounts) | **POST** /v1/redemptions | Redeem Stackable Discounts | -| [**redeem_stacked_discounts_client_side**](StackableDiscountsApi.md#redeem_stacked_discounts_client_side) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) | -| [**rollback_stacked_redemptions**](StackableDiscountsApi.md#rollback_stacked_redemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions | -| [**validate_stacked_discounts**](StackableDiscountsApi.md#validate_stacked_discounts) | **POST** /v1/validations | Validate Stackable Discounts | -| [**validate_stacked_discounts_client_side**](StackableDiscountsApi.md#validate_stacked_discounts_client_side) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) | - - -## redeem_stacked_discounts - -> redeem_stacked_discounts(opts) - -Redeem Stackable Discounts - -## How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: | **Field** | **Calculation** | **Description** | |:---|:---|:---| | amount | N/A | This field shows the order amount before applying any discount | | total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts | | discount_amount | `discount_amount` = `previous_discount_amount` + `applied_discount_amount` | This field sums up all order-level discounts up to and including the specific discount being calculated for the stacked redemption. | | items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts | | total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts | | applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request | | items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request | | total_applied_discount_amount | `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | This field sums up all order-level and all product-specific discounts applied in a particular request | > 📘 Rollbacks > > You can't roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your [rollback request](ref:rollback-stacked-redemptions). > 📘 Also available on client-side > > This method is also accessible through public keys which you can use in client-side​ apps: mobile and web browser apps. Go to the dedicated [endpoint](ref:redeem-stacked-discounts-client-side) to learn more. > - Use `X-Client-Application-Id` as the application ID header. > - Use `X-Client-Token` as the appliction secret key header. > - Use client-side base URL. > - Use an `origin` header for your custom domain. - -### Examples - -```ruby -require 'time' -require 'VoucherifySdk' -# setup authorization -VoucherifySdk.configure do |config| - # Configure API key authorization: X-App-Id - config.api_key['X-App-Id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-App-Id'] = 'Bearer' - - # Configure API key authorization: X-App-Token - config.api_key['X-App-Token'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-App-Token'] = 'Bearer' -end - -api_instance = VoucherifySdk::StackableDiscountsApi.new -opts = { - redemptions_redeem_request_body: VoucherifySdk::RedemptionsRedeemRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # RedemptionsRedeemRequestBody | -} - -begin - # Redeem Stackable Discounts - result = api_instance.redeem_stacked_discounts(opts) - p result -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->redeem_stacked_discounts: #{e}" -end -``` - -#### Using the redeem_stacked_discounts_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> , Integer, Hash)> redeem_stacked_discounts_with_http_info(opts) - -```ruby -begin - # Redeem Stackable Discounts - data, status_code, headers = api_instance.redeem_stacked_discounts_with_http_info(opts) - p status_code # => 2xx - p headers # => { ... } - p data # => -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->redeem_stacked_discounts_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **redemptions_redeem_request_body** | [**RedemptionsRedeemRequestBody**](RedemptionsRedeemRequestBody.md) | | [optional] | - -### Return type - -[**RedemptionsRedeemResponseBody**](RedemptionsRedeemResponseBody.md) - -### Authorization - -[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - - -## redeem_stacked_discounts_client_side - -> redeem_stacked_discounts_client_side(origin, opts) - -Redeem Stackable Discounts (client-side) - -This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. ## How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: | **Field** | **Calculation** | **Description** | |:---|:---|:---| | amount | N/A | This field shows the order amount before applying any discount | | total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts | | discount_amount | `discount_amount` = `previous_discount_amount` + `applied_discount_amount` | This field sums up all order-level discounts up to and including the specific discount being calculated for the stacked redemption. | | items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts | | total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts | | applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request | | items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request | | total_applied_discount_amount | `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | This field sums up all order-level and all product-specific discounts applied in a particular request | > 📘 Rollbacks > > You can't roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your [rollback request](ref:rollback-stacked-redemptions). - -### Examples - -```ruby -require 'time' -require 'VoucherifySdk' -# setup authorization -VoucherifySdk.configure do |config| - # Configure API key authorization: X-Client-Application-Id - config.api_key['X-Client-Application-Id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-Client-Application-Id'] = 'Bearer' - - # Configure API key authorization: X-Client-Token - config.api_key['X-Client-Token'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-Client-Token'] = 'Bearer' -end - -api_instance = VoucherifySdk::StackableDiscountsApi.new -origin = 'origin_example' # String | Indicates the origin (scheme, hostname, and port). -opts = { - client_redemptions_redeem_request_body: VoucherifySdk::ClientRedemptionsRedeemRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # ClientRedemptionsRedeemRequestBody | -} - -begin - # Redeem Stackable Discounts (client-side) - result = api_instance.redeem_stacked_discounts_client_side(origin, opts) - p result -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->redeem_stacked_discounts_client_side: #{e}" -end -``` - -#### Using the redeem_stacked_discounts_client_side_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> , Integer, Hash)> redeem_stacked_discounts_client_side_with_http_info(origin, opts) - -```ruby -begin - # Redeem Stackable Discounts (client-side) - data, status_code, headers = api_instance.redeem_stacked_discounts_client_side_with_http_info(origin, opts) - p status_code # => 2xx - p headers # => { ... } - p data # => -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->redeem_stacked_discounts_client_side_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **origin** | **String** | Indicates the origin (scheme, hostname, and port). | | -| **client_redemptions_redeem_request_body** | [**ClientRedemptionsRedeemRequestBody**](ClientRedemptionsRedeemRequestBody.md) | | [optional] | - -### Return type - -[**ClientRedemptionsRedeemResponseBody**](ClientRedemptionsRedeemResponseBody.md) - -### Authorization - -[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - - -## rollback_stacked_redemptions - -> rollback_stacked_redemptions(parent_redemption_id, opts) - -Rollback Stackable Redemptions - -Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. - -### Examples - -```ruby -require 'time' -require 'VoucherifySdk' -# setup authorization -VoucherifySdk.configure do |config| - # Configure API key authorization: X-App-Id - config.api_key['X-App-Id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-App-Id'] = 'Bearer' - - # Configure API key authorization: X-App-Token - config.api_key['X-App-Token'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-App-Token'] = 'Bearer' -end - -api_instance = VoucherifySdk::StackableDiscountsApi.new -parent_redemption_id = 'parent_redemption_id_example' # String | Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. -opts = { - reason: 'reason_example', # String | Reason for the rollback. - tracking_id: 'tracking_id_example', # String | Customer's `source_id`. - redemptions_rollbacks_create_request_body: VoucherifySdk::RedemptionsRollbacksCreateRequestBody.new # RedemptionsRollbacksCreateRequestBody | Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. -} - -begin - # Rollback Stackable Redemptions - result = api_instance.rollback_stacked_redemptions(parent_redemption_id, opts) - p result -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->rollback_stacked_redemptions: #{e}" -end -``` - -#### Using the rollback_stacked_redemptions_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> , Integer, Hash)> rollback_stacked_redemptions_with_http_info(parent_redemption_id, opts) - -```ruby -begin - # Rollback Stackable Redemptions - data, status_code, headers = api_instance.rollback_stacked_redemptions_with_http_info(parent_redemption_id, opts) - p status_code # => 2xx - p headers # => { ... } - p data # => -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->rollback_stacked_redemptions_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **parent_redemption_id** | **String** | Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. | | -| **reason** | **String** | Reason for the rollback. | [optional] | -| **tracking_id** | **String** | Customer's `source_id`. | [optional] | -| **redemptions_rollbacks_create_request_body** | [**RedemptionsRollbacksCreateRequestBody**](RedemptionsRollbacksCreateRequestBody.md) | Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. | [optional] | - -### Return type - -[**RedemptionsRollbacksCreateResponseBody**](RedemptionsRollbacksCreateResponseBody.md) - -### Authorization - -[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - - -## validate_stacked_discounts - -> validate_stacked_discounts(opts) - -Validate Stackable Discounts - -Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys. - -### Examples - -```ruby -require 'time' -require 'VoucherifySdk' -# setup authorization -VoucherifySdk.configure do |config| - # Configure API key authorization: X-App-Id - config.api_key['X-App-Id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-App-Id'] = 'Bearer' - - # Configure API key authorization: X-App-Token - config.api_key['X-App-Token'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-App-Token'] = 'Bearer' -end - -api_instance = VoucherifySdk::StackableDiscountsApi.new -opts = { - validations_validate_request_body: VoucherifySdk::ValidationsValidateRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # ValidationsValidateRequestBody | -} - -begin - # Validate Stackable Discounts - result = api_instance.validate_stacked_discounts(opts) - p result -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->validate_stacked_discounts: #{e}" -end -``` - -#### Using the validate_stacked_discounts_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> , Integer, Hash)> validate_stacked_discounts_with_http_info(opts) - -```ruby -begin - # Validate Stackable Discounts - data, status_code, headers = api_instance.validate_stacked_discounts_with_http_info(opts) - p status_code # => 2xx - p headers # => { ... } - p data # => -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->validate_stacked_discounts_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **validations_validate_request_body** | [**ValidationsValidateRequestBody**](ValidationsValidateRequestBody.md) | | [optional] | - -### Return type - -[**ValidationsValidateResponseBody**](ValidationsValidateResponseBody.md) - -### Authorization - -[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - - -## validate_stacked_discounts_client_side - -> validate_stacked_discounts_client_side(origin, opts) - -Validate Stackable Discounts (client-side) - -Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. - -### Examples - -```ruby -require 'time' -require 'VoucherifySdk' -# setup authorization -VoucherifySdk.configure do |config| - # Configure API key authorization: X-Client-Application-Id - config.api_key['X-Client-Application-Id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-Client-Application-Id'] = 'Bearer' - - # Configure API key authorization: X-Client-Token - config.api_key['X-Client-Token'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['X-Client-Token'] = 'Bearer' -end - -api_instance = VoucherifySdk::StackableDiscountsApi.new -origin = 'origin_example' # String | Indicates the origin (scheme, hostname, and port). -opts = { - client_validations_validate_request_body: VoucherifySdk::ClientValidationsValidateRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # ClientValidationsValidateRequestBody | -} - -begin - # Validate Stackable Discounts (client-side) - result = api_instance.validate_stacked_discounts_client_side(origin, opts) - p result -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->validate_stacked_discounts_client_side: #{e}" -end -``` - -#### Using the validate_stacked_discounts_client_side_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> , Integer, Hash)> validate_stacked_discounts_client_side_with_http_info(origin, opts) - -```ruby -begin - # Validate Stackable Discounts (client-side) - data, status_code, headers = api_instance.validate_stacked_discounts_client_side_with_http_info(origin, opts) - p status_code # => 2xx - p headers # => { ... } - p data # => -rescue VoucherifySdk::ApiError => e - puts "Error when calling StackableDiscountsApi->validate_stacked_discounts_client_side_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **origin** | **String** | Indicates the origin (scheme, hostname, and port). | | -| **client_validations_validate_request_body** | [**ClientValidationsValidateRequestBody**](ClientValidationsValidateRequestBody.md) | | [optional] | - -### Return type - -[**ClientValidationsValidateResponseBody**](ClientValidationsValidateResponseBody.md) - -### Authorization - -[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - diff --git a/docs/StackableValidateRedeemBase.md b/docs/StackableValidateRedeemBase.md deleted file mode 100644 index b4f421e8..00000000 --- a/docs/StackableValidateRedeemBase.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::StackableValidateRedeemBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **redeemables** | [**Array<StackableValidateRedeemBaseRedeemablesItem>**](StackableValidateRedeemBaseRedeemablesItem.md) | An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. | | -| **order** | [**Order**](Order.md) | | [optional] | -| **customer** | [**Customer**](Customer.md) | | [optional] | -| **session** | [**Session**](Session.md) | | [optional] | -| **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | -| **metadata** | **Object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] | - diff --git a/docs/StackableValidateRedeemBaseRedeemablesItem.md b/docs/StackableValidateRedeemBaseRedeemablesItem.md deleted file mode 100644 index 1049bfdb..00000000 --- a/docs/StackableValidateRedeemBaseRedeemablesItem.md +++ /dev/null @@ -1,55 +0,0 @@ -# VoucherifySdk::StackableValidateRedeemBaseRedeemablesItem - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::StackableValidateRedeemBaseRedeemablesItem.openapi_one_of -# => -# [ -# :'RedeemGiftCard', -# :'RedeemLoyaltyCard', -# :'RedeemPromotionStack', -# :'RedeemPromotionTier', -# :'RedeemVoucher' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::StackableValidateRedeemBaseRedeemablesItem.build(data) -# => # - -VoucherifySdk::StackableValidateRedeemBaseRedeemablesItem.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `RedeemGiftCard` -- `RedeemLoyaltyCard` -- `RedeemPromotionStack` -- `RedeemPromotionTier` -- `RedeemVoucher` -- `nil` (if no type matches) - diff --git a/docs/StackingRules.md b/docs/StackingRules.md index 423e8dd2..a16ae88b 100644 --- a/docs/StackingRules.md +++ b/docs/StackingRules.md @@ -4,12 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemables_limit** | **Integer** | Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!). | [default to 30] | -| **applicable_redeemables_limit** | **Integer** | Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. | [default to 5] | -| **applicable_exclusive_redeemables_limit** | **Integer** | Defines how many redeemables with an exclusive category can be applied in one request. | [default to 1] | +| **redeemables_limit** | **Integer** | Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!). | [optional][default to 30] | +| **applicable_redeemables_limit** | **Integer** | Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. | [optional][default to 5] | | **applicable_redeemables_per_category_limit** | **Integer** | Defines how many redeemables per category can be applied in one request. | [optional][default to 1] | -| **exclusive_categories** | **Array<String>** | Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. | | -| **joint_categories** | **Array<String>** | Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns. | | +| **applicable_exclusive_redeemables_limit** | **Integer** | Defines how many redeemables with an exclusive category can be applied in one request. | [optional][default to 1] | +| **applicable_exclusive_redeemables_per_category_limit** | **Integer** | Defines how many redeemables with an exclusive category per category in stacking rules can be applied in one request. | [optional][default to 1] | +| **exclusive_categories** | **Array<String>** | Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. | [optional] | +| **joint_categories** | **Array<String>** | Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns. | [optional] | | **redeemables_application_mode** | **String** | Defines redeemables application mode. | [optional] | | **redeemables_sorting_rule** | **String** | Defines redeemables sorting rule. | [optional][default to 'REQUESTED_ORDER'] | +| **redeemables_products_application_mode** | **String** | Defines redeemables products application mode. | [optional] | +| **redeemables_no_effect_rule** | **String** | Defines redeemables no effect rule. | [optional] | diff --git a/docs/ValidationEntity.md b/docs/ValidationEntity.md deleted file mode 100644 index a4c7e645..00000000 --- a/docs/ValidationEntity.md +++ /dev/null @@ -1,15 +0,0 @@ -# VoucherifySdk::ValidationEntity - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique validation id. | [optional] | -| **session_id** | **String** | Unique session id. | [optional] | -| **status** | **String** | The validation status | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the validation was created in ISO 8601 format. | [optional] | -| **customer_id** | **String** | Unique customer ID of the customer making the purchase. | [optional] | -| **redeemables** | [**Array<ValidationsRedeemableApplicable>**](ValidationsRedeemableApplicable.md) | Lists validation results of each redeemable. | [optional] | -| **skipped_redeemables** | [**Array<ValidationsRedeemableInapplicable>**](ValidationsRedeemableInapplicable.md) | Lists validation results of each redeemable. | [optional] | -| **inapplicable_redeemables** | [**Array<ValidationsRedeemableSkipped>**](ValidationsRedeemableSkipped.md) | Lists validation results of each redeemable. | [optional] | - diff --git a/docs/ValidationRule.md b/docs/ValidationRule.md index 8dcf9524..5049dc00 100644 --- a/docs/ValidationRule.md +++ b/docs/ValidationRule.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Custom, unique name for set of validation rules. | | -| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | | -| **type** | **String** | Type of validation rule. | [default to 'expression'] | -| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [default to 'global'] | -| **id** | **String** | Unique validation rule ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. | [optional] | +| **name** | **String** | Custom, unique name for set of validation rules. | [optional] | +| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | +| **error** | [**ValidationRuleError**](ValidationRuleError.md) | | [optional] | +| **applicable_to** | [**ValidationRuleApplicableTo**](ValidationRuleApplicableTo.md) | | [optional] | +| **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | +| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | +| **id** | **String** | Unique validation rule ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] | | **assignments_count** | **Integer** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the validation rule. | [default to 'validation_rules'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional][default to 'validation_rules'] | diff --git a/docs/ValidationRuleApplicableTo.md b/docs/ValidationRuleApplicableTo.md new file mode 100644 index 00000000..2889247a --- /dev/null +++ b/docs/ValidationRuleApplicableTo.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationRuleApplicableTo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | +| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | +| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | + diff --git a/docs/ValidationRuleAssignment.md b/docs/ValidationRuleAssignment.md index e55c21ba..24fbc36e 100644 --- a/docs/ValidationRuleAssignment.md +++ b/docs/ValidationRuleAssignment.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Validation rule assignment ID. | | -| **rule_id** | **String** | Validation rule ID. | | -| **related_object_id** | **String** | The resource ID to which the validation rule was assigned. | | -| **related_object_type** | **String** | The type of resource to which the validation rule was assigned. | | -| **created_at** | **Time** | Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the ID. | [default to 'validation_rules_assignment'] | +| **id** | **String** | Validation rule assignment ID. | [optional] | +| **rule_id** | **String** | Validation rule ID. | [optional] | +| **related_object_id** | **String** | The resource ID to which the validation rule was assigned. | [optional] | +| **related_object_type** | **String** | The type of resource to which the validation rule was assigned. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the ID. | [optional][default to 'validation_rules_assignment'] | diff --git a/docs/ValidationRuleAssignmentsList.md b/docs/ValidationRuleAssignmentsList.md index 52e32a28..33526f7c 100644 --- a/docs/ValidationRuleAssignmentsList.md +++ b/docs/ValidationRuleAssignmentsList.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about validation rule assignments. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [default to 'data'] | -| **data** | [**Array<ValidationRuleAssignment>**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | | -| **total** | **Integer** | Total number of validation rule assignments. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about validation rule assignments. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [optional][default to 'data'] | +| **data** | [**Array<ValidationRuleAssignment>**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | [optional] | +| **total** | **Integer** | Total number of validation rule assignments. | [optional] | diff --git a/docs/ValidationRuleBase.md b/docs/ValidationRuleBase.md deleted file mode 100644 index deba2555..00000000 --- a/docs/ValidationRuleBase.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::ValidationRuleBase - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **name** | **String** | Custom, unique name for set of validation rules. | [optional] | -| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | [optional] | -| **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | -| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | - diff --git a/docs/ValidationRuleBaseApplicableTo.md b/docs/ValidationRuleBaseApplicableTo.md deleted file mode 100644 index a456ddfe..00000000 --- a/docs/ValidationRuleBaseApplicableTo.md +++ /dev/null @@ -1,10 +0,0 @@ -# VoucherifySdk::ValidationRuleBaseApplicableTo - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | -| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | -| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | - diff --git a/docs/ValidationRuleBaseError.md b/docs/ValidationRuleBaseError.md deleted file mode 100644 index 78b4a7d9..00000000 --- a/docs/ValidationRuleBaseError.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::ValidationRuleBaseError - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | - diff --git a/docs/ValidationRuleError.md b/docs/ValidationRuleError.md new file mode 100644 index 00000000..0d9233cf --- /dev/null +++ b/docs/ValidationRuleError.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationRuleError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | + diff --git a/docs/ValidationRulesApi.md b/docs/ValidationRulesApi.md index 0d75c314..8bd60493 100644 --- a/docs/ValidationRulesApi.md +++ b/docs/ValidationRulesApi.md @@ -107,7 +107,7 @@ end api_instance = VoucherifySdk::ValidationRulesApi.new opts = { - validation_rules_create_request_body: VoucherifySdk::ValidationRulesCreateRequestBody.new({name: 'Business Validation Rule'}) # ValidationRulesCreateRequestBody | Specify the validation rules parameters. + validation_rules_create_request_body: VoucherifySdk::ValidationRulesCreateRequestBody.new # ValidationRulesCreateRequestBody | Specify the validation rules parameters. } begin @@ -342,8 +342,8 @@ end api_instance = VoucherifySdk::ValidationRulesApi.new validation_rule_id = 'validation_rule_id_example' # String | Unique validation rule ID. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrderListValidationRuleAssignments::CREATED_AT # ParameterOrderListValidationRuleAssignments | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. } @@ -361,8 +361,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **validation_rule_id** | **String** | Unique validation rule ID. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrderListValidationRuleAssignments**](.md) | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type @@ -407,8 +407,8 @@ end api_instance = VoucherifySdk::ValidationRulesApi.new opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56, # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. order: VoucherifySdk::ParameterOrderListValidationRules::CREATED_AT, # ParameterOrderListValidationRules | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. start_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. end_date: Time.parse('2013-10-20T19:20:30+01:00') # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -427,8 +427,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | | **order** | [**ParameterOrderListValidationRules**](.md) | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | | **start_date** | **Time** | Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. | [optional] | | **end_date** | **Time** | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | @@ -477,8 +477,8 @@ api_instance = VoucherifySdk::ValidationRulesApi.new opts = { related_object_id: 'related_object_id_example', # String | The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. rule: 'rule_example', # String | Validation rule ID. - page: 56, # Integer | Which page of results to return. - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. order: 'order_example' # String | Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. } @@ -497,8 +497,8 @@ end | ---- | ---- | ----------- | ----- | | **related_object_id** | **String** | The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. | [optional] | | **rule** | **String** | Validation rule ID. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | | **order** | **String** | Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | ### Return type diff --git a/docs/ValidationRulesAssignmentsCreateRequestBody.md b/docs/ValidationRulesAssignmentsCreateRequestBody.md index f6aa4ff8..1a4f998e 100644 --- a/docs/ValidationRulesAssignmentsCreateRequestBody.md +++ b/docs/ValidationRulesAssignmentsCreateRequestBody.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **related_object_type** | **String** | Defines the related object. i.e. `voucher`. | [optional][default to 'voucher'] | -| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] | +| **related_object_type** | **String** | Defines the related object, e.g. `voucher`. | [optional][default to 'voucher'] | +| **related_object_id** | **String** | Unique related object ID assigned by Voucherify, e.g. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] | diff --git a/docs/ValidationRulesAssignmentsCreateResponseBody.md b/docs/ValidationRulesAssignmentsCreateResponseBody.md index 1a04495b..11821327 100644 --- a/docs/ValidationRulesAssignmentsCreateResponseBody.md +++ b/docs/ValidationRulesAssignmentsCreateResponseBody.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Validation rule assignment ID. | | -| **rule_id** | **String** | Validation rule ID. | | -| **related_object_id** | **String** | The resource ID to which the validation rule was assigned. | | -| **related_object_type** | **String** | The type of resource to which the validation rule was assigned. | | -| **created_at** | **Time** | Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format. | | -| **object** | **String** | The type of object represented by the ID. | [default to 'validation_rules_assignment'] | +| **id** | **String** | Validation rule assignment ID. | [optional] | +| **rule_id** | **String** | Validation rule ID. | [optional] | +| **related_object_id** | **String** | The resource ID to which the validation rule was assigned. | [optional] | +| **related_object_type** | **String** | The type of resource to which the validation rule was assigned. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. | [optional] | +| **object** | **String** | The type of the object represented by the ID. | [optional][default to 'validation_rules_assignment'] | diff --git a/docs/ValidationRulesAssignmentsList.md b/docs/ValidationRulesAssignmentsList.md index d4621df2..b019a682 100644 --- a/docs/ValidationRulesAssignmentsList.md +++ b/docs/ValidationRulesAssignmentsList.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about validation rules assignments. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of validation rules assignments. | [default to 'data'] | -| **data** | [**Array<BusValRuleAssignment>**](BusValRuleAssignment.md) | Contains array of validation rules assignments. | | -| **total** | **Integer** | Total number of validation rules assignments. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about validation rules assignments. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of validation rules assignments. | [optional][default to 'data'] | +| **data** | [**Array<BusValRuleAssignment>**](BusValRuleAssignment.md) | Contains array of validation rules assignments. | [optional] | +| **total** | **Integer** | Total number of validation rules assignments. | [optional] | diff --git a/docs/ValidationRulesAssignmentsListResponseBody.md b/docs/ValidationRulesAssignmentsListResponseBody.md index 414facd6..5c8e5f86 100644 --- a/docs/ValidationRulesAssignmentsListResponseBody.md +++ b/docs/ValidationRulesAssignmentsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about validation rule assignments. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [default to 'data'] | -| **data** | [**Array<ValidationRuleAssignment>**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | | -| **total** | **Integer** | Total number of validation rule assignments. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about validation rule assignments. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [optional][default to 'data'] | +| **data** | [**Array<ValidationRuleAssignment>**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | [optional] | +| **total** | **Integer** | Total number of validation rule assignments. | [optional] | diff --git a/docs/ValidationRulesCreateRequestBody.md b/docs/ValidationRulesCreateRequestBody.md index 3408b1e5..21d8df58 100644 --- a/docs/ValidationRulesCreateRequestBody.md +++ b/docs/ValidationRulesCreateRequestBody.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Custom, unique name for set of validation rules. | | +| **name** | **String** | Custom, unique name for set of validation rules. | [optional] | | **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | [optional] | +| **error** | [**ValidationRulesCreateRequestBodyError**](ValidationRulesCreateRequestBodyError.md) | | [optional] | +| **applicable_to** | [**ValidationRulesCreateRequestBodyApplicableTo**](ValidationRulesCreateRequestBodyApplicableTo.md) | | [optional] | | **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | | **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | diff --git a/docs/ValidationRulesCreateRequestBodyApplicableTo.md b/docs/ValidationRulesCreateRequestBodyApplicableTo.md new file mode 100644 index 00000000..ba3a4737 --- /dev/null +++ b/docs/ValidationRulesCreateRequestBodyApplicableTo.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationRulesCreateRequestBodyApplicableTo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | +| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | +| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | + diff --git a/docs/ValidationRulesCreateRequestBodyError.md b/docs/ValidationRulesCreateRequestBodyError.md new file mode 100644 index 00000000..4b1258d7 --- /dev/null +++ b/docs/ValidationRulesCreateRequestBodyError.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationRulesCreateRequestBodyError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | + diff --git a/docs/ValidationRulesCreateResponseBody.md b/docs/ValidationRulesCreateResponseBody.md index 92e2276b..d5ed2990 100644 --- a/docs/ValidationRulesCreateResponseBody.md +++ b/docs/ValidationRulesCreateResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Custom, unique name for set of validation rules. | | -| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | | -| **type** | **String** | Type of validation rule. | [default to 'expression'] | -| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [default to 'global'] | -| **id** | **String** | Unique validation rule ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. | [optional] | +| **name** | **String** | Custom, unique name for set of validation rules. | [optional] | +| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | +| **error** | [**ValidationRulesCreateResponseBodyError**](ValidationRulesCreateResponseBodyError.md) | | [optional] | +| **applicable_to** | [**ValidationRulesCreateResponseBodyApplicableTo**](ValidationRulesCreateResponseBodyApplicableTo.md) | | [optional] | +| **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | +| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | +| **id** | **String** | Unique validation rule ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] | | **assignments_count** | **Integer** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the validation rule. | [default to 'validation_rules'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional][default to 'validation_rules'] | diff --git a/docs/ValidationRulesCreateResponseBodyApplicableTo.md b/docs/ValidationRulesCreateResponseBodyApplicableTo.md new file mode 100644 index 00000000..7aabf08e --- /dev/null +++ b/docs/ValidationRulesCreateResponseBodyApplicableTo.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationRulesCreateResponseBodyApplicableTo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | +| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | +| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | + diff --git a/docs/ValidationRulesCreateResponseBodyError.md b/docs/ValidationRulesCreateResponseBodyError.md new file mode 100644 index 00000000..a99643a9 --- /dev/null +++ b/docs/ValidationRulesCreateResponseBodyError.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationRulesCreateResponseBodyError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | + diff --git a/docs/ValidationRulesGetResponseBody.md b/docs/ValidationRulesGetResponseBody.md index 887e55a4..50c752ba 100644 --- a/docs/ValidationRulesGetResponseBody.md +++ b/docs/ValidationRulesGetResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Custom, unique name for set of validation rules. | | -| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | | -| **type** | **String** | Type of validation rule. | [default to 'expression'] | -| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [default to 'global'] | -| **id** | **String** | Unique validation rule ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. | [optional] | +| **name** | **String** | Custom, unique name for set of validation rules. | [optional] | +| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | +| **error** | [**ValidationRulesGetResponseBodyError**](ValidationRulesGetResponseBodyError.md) | | [optional] | +| **applicable_to** | [**ValidationRulesGetResponseBodyApplicableTo**](ValidationRulesGetResponseBodyApplicableTo.md) | | [optional] | +| **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | +| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | +| **id** | **String** | Unique validation rule ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] | | **assignments_count** | **Integer** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the validation rule. | [default to 'validation_rules'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional][default to 'validation_rules'] | diff --git a/docs/ValidationRulesGetResponseBodyApplicableTo.md b/docs/ValidationRulesGetResponseBodyApplicableTo.md new file mode 100644 index 00000000..449764e1 --- /dev/null +++ b/docs/ValidationRulesGetResponseBodyApplicableTo.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationRulesGetResponseBodyApplicableTo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | +| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | +| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | + diff --git a/docs/ValidationRulesGetResponseBodyError.md b/docs/ValidationRulesGetResponseBodyError.md new file mode 100644 index 00000000..e80fbfd2 --- /dev/null +++ b/docs/ValidationRulesGetResponseBodyError.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationRulesGetResponseBodyError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | + diff --git a/docs/ValidationRulesListResponseBody.md b/docs/ValidationRulesListResponseBody.md index 77c1e9b3..2a729990 100644 --- a/docs/ValidationRulesListResponseBody.md +++ b/docs/ValidationRulesListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. This object stores information about validation rules. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of validation rules. | [default to 'data'] | -| **data** | [**Array<ValidationRule>**](ValidationRule.md) | An array of validation rules. | | -| **total** | **Integer** | Total number of validation rules in the project. | | +| **object** | **String** | The type of the object represented by JSON. This object stores information about validation rules. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of validation rules. | [optional][default to 'data'] | +| **data** | [**Array<ValidationRule>**](ValidationRule.md) | An array of validation rules. | [optional] | +| **total** | **Integer** | Total number of validation rules in the project. | [optional] | diff --git a/docs/ValidationRulesUpdateRequestBody.md b/docs/ValidationRulesUpdateRequestBody.md index 93582512..4e666a04 100644 --- a/docs/ValidationRulesUpdateRequestBody.md +++ b/docs/ValidationRulesUpdateRequestBody.md @@ -6,8 +6,8 @@ | ---- | ---- | ----------- | ----- | | **name** | **String** | Custom, unique name for set of validation rules. | [optional] | | **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | [optional] | +| **error** | [**ValidationRulesUpdateRequestBodyError**](ValidationRulesUpdateRequestBodyError.md) | | [optional] | +| **applicable_to** | [**ValidationRulesUpdateRequestBodyApplicableTo**](ValidationRulesUpdateRequestBodyApplicableTo.md) | | [optional] | | **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | | **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | diff --git a/docs/ValidationRulesUpdateRequestBodyApplicableTo.md b/docs/ValidationRulesUpdateRequestBodyApplicableTo.md new file mode 100644 index 00000000..88525f45 --- /dev/null +++ b/docs/ValidationRulesUpdateRequestBodyApplicableTo.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationRulesUpdateRequestBodyApplicableTo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | +| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | +| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | + diff --git a/docs/ValidationRulesUpdateRequestBodyError.md b/docs/ValidationRulesUpdateRequestBodyError.md new file mode 100644 index 00000000..e9c1e328 --- /dev/null +++ b/docs/ValidationRulesUpdateRequestBodyError.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationRulesUpdateRequestBodyError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | + diff --git a/docs/ValidationRulesUpdateResponseBody.md b/docs/ValidationRulesUpdateResponseBody.md index a1cd7232..dc048bd3 100644 --- a/docs/ValidationRulesUpdateResponseBody.md +++ b/docs/ValidationRulesUpdateResponseBody.md @@ -4,15 +4,15 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | Custom, unique name for set of validation rules. | | -| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | | -| **error** | [**ValidationRuleBaseError**](ValidationRuleBaseError.md) | | [optional] | -| **applicable_to** | [**ValidationRuleBaseApplicableTo**](ValidationRuleBaseApplicableTo.md) | | | -| **type** | **String** | Type of validation rule. | [default to 'expression'] | -| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [default to 'global'] | -| **id** | **String** | Unique validation rule ID. | | -| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created in ISO 8601 format. | | -| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. | [optional] | +| **name** | **String** | Custom, unique name for set of validation rules. | [optional] | +| **rules** | **Object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] | +| **error** | [**ValidationRulesUpdateResponseBodyError**](ValidationRulesUpdateResponseBodyError.md) | | [optional] | +| **applicable_to** | [**ValidationRulesUpdateResponseBodyApplicableTo**](ValidationRulesUpdateResponseBodyApplicableTo.md) | | [optional] | +| **type** | **String** | Type of validation rule. | [optional][default to 'expression'] | +| **context_type** | **String** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional][default to 'global'] | +| **id** | **String** | Unique validation rule ID. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] | | **assignments_count** | **Integer** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] | -| **object** | **String** | The type of object represented by JSON. This object stores information about the validation rule. | [default to 'validation_rules'] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional][default to 'validation_rules'] | diff --git a/docs/ValidationRulesUpdateResponseBodyApplicableTo.md b/docs/ValidationRulesUpdateResponseBodyApplicableTo.md new file mode 100644 index 00000000..63958ab8 --- /dev/null +++ b/docs/ValidationRulesUpdateResponseBodyApplicableTo.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationRulesUpdateResponseBodyApplicableTo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **excluded** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] | +| **included** | [**Array<ApplicableTo>**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] | +| **included_all** | **Boolean** | Indicates whether all items are included in the discount. | [optional] | + diff --git a/docs/ValidationRulesUpdateResponseBodyError.md b/docs/ValidationRulesUpdateResponseBodyError.md new file mode 100644 index 00000000..d1a0d885 --- /dev/null +++ b/docs/ValidationRulesUpdateResponseBodyError.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationRulesUpdateResponseBodyError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] | + diff --git a/docs/ValidationsApi.md b/docs/ValidationsApi.md index 45317c8c..6e16f243 100644 --- a/docs/ValidationsApi.md +++ b/docs/ValidationsApi.md @@ -35,7 +35,7 @@ end api_instance = VoucherifySdk::ValidationsApi.new opts = { - validations_validate_request_body: VoucherifySdk::ValidationsValidateRequestBody.new({redeemables: [VoucherifySdk::RedeemGiftCard.new({object: 'voucher', id: 'id_example'})]}) # ValidationsValidateRequestBody | + validations_validate_request_body: VoucherifySdk::ValidationsValidateRequestBody.new # ValidationsValidateRequestBody | } begin diff --git a/docs/ValidationsRedeemableApplicable.md b/docs/ValidationsRedeemableApplicable.md deleted file mode 100644 index 6d90fc28..00000000 --- a/docs/ValidationsRedeemableApplicable.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::ValidationsRedeemableApplicable - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **status** | **String** | Indicates whether the redeemable can be applied or not applied based on the validation rules. | [optional][default to 'APPLICABLE'] | -| **id** | **String** | Redeemable ID, i.e. the voucher code. | [optional] | -| **object** | **String** | Redeemable's object type. | [optional] | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] | -| **inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] | -| **result** | [**ValidationsRedeemableApplicableResult**](ValidationsRedeemableApplicableResult.md) | | [optional] | -| **metadata** | **Object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | | [optional] | - diff --git a/docs/ValidationsRedeemableApplicableResult.md b/docs/ValidationsRedeemableApplicableResult.md deleted file mode 100644 index adebc619..00000000 --- a/docs/ValidationsRedeemableApplicableResult.md +++ /dev/null @@ -1,55 +0,0 @@ -# VoucherifySdk::ValidationsRedeemableApplicableResult - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ValidationsRedeemableApplicableResult.openapi_one_of -# => -# [ -# :'RedeemableResultGiftCard', -# :'RedeemableResultLoyaltyCard', -# :'RedeemableResultPromotionStack', -# :'RedeemableResultPromotionTier', -# :'RedeemableResultVoucherCode' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ValidationsRedeemableApplicableResult.build(data) -# => # - -VoucherifySdk::ValidationsRedeemableApplicableResult.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `RedeemableResultGiftCard` -- `RedeemableResultLoyaltyCard` -- `RedeemableResultPromotionStack` -- `RedeemableResultPromotionTier` -- `RedeemableResultVoucherCode` -- `nil` (if no type matches) - diff --git a/docs/ValidationsRedeemableInapplicable.md b/docs/ValidationsRedeemableInapplicable.md index d6c20914..185499f5 100644 --- a/docs/ValidationsRedeemableInapplicable.md +++ b/docs/ValidationsRedeemableInapplicable.md @@ -8,4 +8,6 @@ | **id** | **String** | Redeemable ID, i.e. the voucher code. | [optional] | | **object** | **String** | Redeemable's object type. | [optional] | | **result** | [**ValidationsRedeemableInapplicableResult**](ValidationsRedeemableInapplicableResult.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | diff --git a/docs/ValidationsRedeemableInapplicableResult.md b/docs/ValidationsRedeemableInapplicableResult.md index b69d724d..8cd22767 100644 --- a/docs/ValidationsRedeemableInapplicableResult.md +++ b/docs/ValidationsRedeemableInapplicableResult.md @@ -5,4 +5,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **error** | [**Error**](Error.md) | | [optional] | +| **details** | [**ValidationsRedeemableInapplicableResultDetails**](ValidationsRedeemableInapplicableResultDetails.md) | | [optional] | diff --git a/docs/ValidationsRedeemableInapplicableResultDetails.md b/docs/ValidationsRedeemableInapplicableResultDetails.md new file mode 100644 index 00000000..1e369708 --- /dev/null +++ b/docs/ValidationsRedeemableInapplicableResultDetails.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ValidationsRedeemableInapplicableResultDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Generic message from the `message` string shown in the `error` object or the message configured in a validation rule. | [optional] | +| **key** | **String** | Generic message from the `key` string shown in the `error` object. | [optional] | + diff --git a/docs/ValidationsRedeemableSkipped.md b/docs/ValidationsRedeemableSkipped.md index 03f34506..10ed5389 100644 --- a/docs/ValidationsRedeemableSkipped.md +++ b/docs/ValidationsRedeemableSkipped.md @@ -7,5 +7,7 @@ | **status** | **String** | Indicates whether the redeemable can be applied or not applied based on the validation rules. | [optional][default to 'SKIPPED'] | | **id** | **String** | Redeemable ID, i.e. the voucher code. | [optional] | | **object** | **String** | Redeemable's object type. | [optional] | -| **result** | **Object** | | [optional] | +| **result** | [**ValidationsRedeemableSkippedResult**](ValidationsRedeemableSkippedResult.md) | | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | diff --git a/docs/ValidationsRedeemableSkippedResult.md b/docs/ValidationsRedeemableSkippedResult.md new file mode 100644 index 00000000..69c0035d --- /dev/null +++ b/docs/ValidationsRedeemableSkippedResult.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationsRedeemableSkippedResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **details** | [**ValidationsRedeemableSkippedResultDetails**](ValidationsRedeemableSkippedResultDetails.md) | | [optional] | + diff --git a/docs/ValidationsRedeemableSkippedResultDetails.md b/docs/ValidationsRedeemableSkippedResultDetails.md new file mode 100644 index 00000000..40c24249 --- /dev/null +++ b/docs/ValidationsRedeemableSkippedResultDetails.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ValidationsRedeemableSkippedResultDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **key** | **String** | | [optional] | +| **message** | **String** | | [optional] | + diff --git a/docs/ValidationsValidateAllResponseBody.md b/docs/ValidationsValidateAllResponseBody.md deleted file mode 100644 index c32f0f3c..00000000 --- a/docs/ValidationsValidateAllResponseBody.md +++ /dev/null @@ -1,13 +0,0 @@ -# VoucherifySdk::ValidationsValidateAllResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **valid** | **Boolean** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | | -| **redeemables** | [**Array<ValidationsValidateAllResponseBodyRedeemablesItem>**](ValidationsValidateAllResponseBodyRedeemablesItem.md) | Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. | | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **tracking_id** | **String** | Hashed customer source ID. | [optional] | -| **session** | [**Session**](Session.md) | | [optional] | -| **application_mode** | **String** | | [default to 'ALL'] | - diff --git a/docs/ValidationsValidateAllResponseBodyRedeemablesItem.md b/docs/ValidationsValidateAllResponseBodyRedeemablesItem.md deleted file mode 100644 index f4067b85..00000000 --- a/docs/ValidationsValidateAllResponseBodyRedeemablesItem.md +++ /dev/null @@ -1,51 +0,0 @@ -# VoucherifySdk::ValidationsValidateAllResponseBodyRedeemablesItem - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ValidationsValidateAllResponseBodyRedeemablesItem.openapi_one_of -# => -# [ -# :'ValidationsRedeemableApplicable', -# :'ValidationsRedeemableInapplicable', -# :'ValidationsRedeemableSkipped' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::ValidationsValidateAllResponseBodyRedeemablesItem.build(data) -# => # - -VoucherifySdk::ValidationsValidateAllResponseBodyRedeemablesItem.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `ValidationsRedeemableApplicable` -- `ValidationsRedeemableInapplicable` -- `ValidationsRedeemableSkipped` -- `nil` (if no type matches) - diff --git a/docs/ValidationsValidatePartialResponseBody.md b/docs/ValidationsValidatePartialResponseBody.md deleted file mode 100644 index 48dc0d71..00000000 --- a/docs/ValidationsValidatePartialResponseBody.md +++ /dev/null @@ -1,14 +0,0 @@ -# VoucherifySdk::ValidationsValidatePartialResponseBody - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **valid** | **Boolean** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | | -| **redeemables** | [**Array<ValidationsRedeemableApplicable>**](ValidationsRedeemableApplicable.md) | Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. | | -| **inapplicable_redeemables** | [**Array<ValidationsRedeemableInapplicable>**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | | -| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | -| **tracking_id** | **String** | Hashed customer source ID. | [optional] | -| **session** | [**Session**](Session.md) | | [optional] | -| **application_mode** | **String** | | [default to 'PARTIAL'] | - diff --git a/docs/ValidationsValidateRequestBody.md b/docs/ValidationsValidateRequestBody.md index c573d443..7ef2e3a2 100644 --- a/docs/ValidationsValidateRequestBody.md +++ b/docs/ValidationsValidateRequestBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **redeemables** | [**Array<StackableValidateRedeemBaseRedeemablesItem>**](StackableValidateRedeemBaseRedeemablesItem.md) | An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. | | +| **options** | [**ValidationsValidateRequestBodyOptions**](ValidationsValidateRequestBodyOptions.md) | | [optional] | +| **redeemables** | [**Array<ValidationsValidateRequestBodyRedeemablesItem>**](ValidationsValidateRequestBodyRedeemablesItem.md) | | [optional] | | **order** | [**Order**](Order.md) | | [optional] | | **customer** | [**Customer**](Customer.md) | | [optional] | | **session** | [**Session**](Session.md) | | [optional] | | **tracking_id** | **String** | Is correspondent to Customer's source_id | [optional] | | **metadata** | **Object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] | -| **options** | [**ClientValidationsValidateRequestBodyAllOfOptions**](ClientValidationsValidateRequestBodyAllOfOptions.md) | | [optional] | diff --git a/docs/ValidationsValidateRequestBodyOptions.md b/docs/ValidationsValidateRequestBodyOptions.md new file mode 100644 index 00000000..20b866d0 --- /dev/null +++ b/docs/ValidationsValidateRequestBodyOptions.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationsValidateRequestBodyOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expand** | **Array<String>** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] | + diff --git a/docs/ValidationsValidateRequestBodyRedeemablesItem.md b/docs/ValidationsValidateRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..91b8d67a --- /dev/null +++ b/docs/ValidationsValidateRequestBodyRedeemablesItem.md @@ -0,0 +1,11 @@ +# VoucherifySdk::ValidationsValidateRequestBodyRedeemablesItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | +| **id** | **String** | | [optional] | +| **gift** | [**ValidationsValidateRequestBodyRedeemablesItemGift**](ValidationsValidateRequestBodyRedeemablesItemGift.md) | | [optional] | +| **reward** | [**ValidationsValidateRequestBodyRedeemablesItemReward**](ValidationsValidateRequestBodyRedeemablesItemReward.md) | | [optional] | + diff --git a/docs/ValidationsValidateRequestBodyRedeemablesItemGift.md b/docs/ValidationsValidateRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..3af507ca --- /dev/null +++ b/docs/ValidationsValidateRequestBodyRedeemablesItemGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationsValidateRequestBodyRedeemablesItemGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **credits** | **Integer** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] | + diff --git a/docs/ValidationsValidateRequestBodyRedeemablesItemReward.md b/docs/ValidationsValidateRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..4e3b0a5c --- /dev/null +++ b/docs/ValidationsValidateRequestBodyRedeemablesItemReward.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ValidationsValidateRequestBodyRedeemablesItemReward + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] | +| **points** | **Integer** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] | + diff --git a/docs/ValidationsValidateResponseBody.md b/docs/ValidationsValidateResponseBody.md index 1dc6098d..7f14add7 100644 --- a/docs/ValidationsValidateResponseBody.md +++ b/docs/ValidationsValidateResponseBody.md @@ -4,11 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **valid** | **Boolean** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | | -| **redeemables** | [**Array<ValidationsValidateAllResponseBodyRedeemablesItem>**](ValidationsValidateAllResponseBodyRedeemablesItem.md) | Lists validation results of each redeemable. If redeemables_application_mode=\"PARTIAL\" all redeemables here will be \"APPLICABLE\" | | -| **skipped_redeemables** | [**Array<ValidationsRedeemableInapplicable>**](ValidationsRedeemableInapplicable.md) | Lists validation results of each skipped redeemable. | [optional] | +| **valid** | **Boolean** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | [optional] | +| **redeemables** | [**Array<ValidationsValidateResponseBodyRedeemablesItem>**](ValidationsValidateResponseBodyRedeemablesItem.md) | | [optional] | +| **skipped_redeemables** | [**Array<ValidationsRedeemableSkipped>**](ValidationsRedeemableSkipped.md) | Lists validation results of each skipped redeemable. | [optional] | | **inapplicable_redeemables** | [**Array<ValidationsRedeemableInapplicable>**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] | | **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | | **tracking_id** | **String** | Hashed customer source ID. | [optional] | | **session** | [**Session**](Session.md) | | [optional] | +| **stacking_rules** | [**StackingRules**](StackingRules.md) | | | diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItem.md b/docs/ValidationsValidateResponseBodyRedeemablesItem.md new file mode 100644 index 00000000..b2d81904 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItem.md @@ -0,0 +1,16 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | | [optional] | +| **id** | **String** | Redeemable ID, i.e. the voucher code. | [optional] | +| **object** | **String** | Redeemable's object type. | [optional] | +| **order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] | +| **applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] | +| **inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] | +| **result** | [**ValidationsValidateResponseBodyRedeemablesItemResult**](ValidationsValidateResponseBodyRedeemablesItemResult.md) | | [optional] | +| **metadata** | **Object** | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | | [optional] | + diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItemResult.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResult.md new file mode 100644 index 00000000..8d347d81 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResult.md @@ -0,0 +1,12 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **discount** | [**ValidationsValidateResponseBodyRedeemablesItemResultDiscount**](ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) | | [optional] | +| **gift** | [**ValidationsValidateResponseBodyRedeemablesItemResultGift**](ValidationsValidateResponseBodyRedeemablesItemResultGift.md) | | [optional] | +| **loyalty_card** | [**ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard**](ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) | | [optional] | +| **error** | [**Error**](Error.md) | | [optional] | +| **details** | [**ValidationsValidateResponseBodyRedeemablesItemResultDetails**](ValidationsValidateResponseBodyRedeemablesItemResultDetails.md) | | [optional] | + diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md new file mode 100644 index 00000000..b5271414 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **key** | **String** | | [optional] | +| **message** | **String** | | [optional] | + diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md new file mode 100644 index 00000000..2f06e047 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md @@ -0,0 +1,24 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultDiscount + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **amount_off** | **Float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] | +| **amount_off_formula** | **String** | | [optional] | +| **aggregated_amount_limit** | **Integer** | Maximum discount amount per order. | [optional] | +| **effect** | **String** | | [optional] | +| **is_dynamic** | **Boolean** | Flag indicating whether the discount was calculated using a formula. | [optional] | +| **unit_off** | **Integer** | Number of units to be granted a full value discount. | [optional] | +| **unit_off_formula** | **String** | | [optional] | +| **unit_type** | **String** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] | +| **product** | [**ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct**](ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) | | [optional] | +| **sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] | +| **units** | [**Array<DiscountUnitMultipleOneUnit>**](DiscountUnitMultipleOneUnit.md) | | [optional] | +| **percent_off** | **Float** | The percent discount that the customer will receive. | [optional] | +| **percent_off_formula** | **String** | | [optional] | +| **amount_limit** | **Float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] | +| **fixed_amount** | **Float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] | +| **fixed_amount_formula** | **String** | | [optional] | + diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md new file mode 100644 index 00000000..f5bbfc3e --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique product ID, assigned by Voucherify. | [optional] | +| **source_id** | **String** | Product's source ID. | [optional] | +| **name** | **String** | Product name. | [optional] | + diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md new file mode 100644 index 00000000..44fb5750 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **credits** | **Integer** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] | + diff --git a/docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md new file mode 100644 index 00000000..7527f17e --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total number of loyalty points to be applied in the redemption. | [optional] | + diff --git a/docs/ValidityHours.md b/docs/ValidityHours.md new file mode 100644 index 00000000..747f21b3 --- /dev/null +++ b/docs/ValidityHours.md @@ -0,0 +1,8 @@ +# VoucherifySdk::ValidityHours + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **daily** | [**Array<ValidityHoursDailyItem>**](ValidityHoursDailyItem.md) | Defines the reccuring period(s) when the resource is active. The periods should not overlap. | [optional] | + diff --git a/docs/ValidityHoursDailyItem.md b/docs/ValidityHoursDailyItem.md new file mode 100644 index 00000000..ba002e60 --- /dev/null +++ b/docs/ValidityHoursDailyItem.md @@ -0,0 +1,10 @@ +# VoucherifySdk::ValidityHoursDailyItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start_time** | **String** | Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time. | [optional] | +| **days_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the resource is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **expiration_time** | **String** | Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time. | [optional] | + diff --git a/docs/ValidityTimeframe.md b/docs/ValidityTimeframe.md new file mode 100644 index 00000000..4e82febf --- /dev/null +++ b/docs/ValidityTimeframe.md @@ -0,0 +1,9 @@ +# VoucherifySdk::ValidityTimeframe + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **duration** | **String** | Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour. | [optional] | +| **interval** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day. | [optional] | + diff --git a/docs/Voucher.md b/docs/Voucher.md index 70f496ce..84118d17 100644 --- a/docs/Voucher.md +++ b/docs/Voucher.md @@ -10,28 +10,27 @@ | **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | | **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | | **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **type** | **String** | Defines the type of the voucher. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | | **gift** | [**VoucherGift**](VoucherGift.md) | | [optional] | | **loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] | | **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**VoucherValidityTimeframe**](VoucherValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | | **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | | **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | -| **distributions** | **Array<Object>** | | [optional] | -| **deleted** | **Boolean** | Flag indicating whether this voucher is deleted. | [optional] | -| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | | **publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] | | **redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | diff --git a/docs/VoucherAssets.md b/docs/VoucherAssets.md index 5c91a496..c53fbada 100644 --- a/docs/VoucherAssets.md +++ b/docs/VoucherAssets.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **qr** | [**LoyaltiesMembersTransfersCreateResponseBodyAssetsQr**](LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md) | | [optional] | -| **barcode** | [**LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode**](LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md) | | [optional] | +| **qr** | [**VoucherAssetsQr**](VoucherAssetsQr.md) | | [optional] | +| **barcode** | [**VoucherAssetsBarcode**](VoucherAssetsBarcode.md) | | [optional] | diff --git a/docs/VoucherAssetsBarcode.md b/docs/VoucherAssetsBarcode.md new file mode 100644 index 00000000..33032755 --- /dev/null +++ b/docs/VoucherAssetsBarcode.md @@ -0,0 +1,9 @@ +# VoucherifySdk::VoucherAssetsBarcode + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Encrypted voucher code ID. | [optional] | +| **url** | **String** | URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] | + diff --git a/docs/VoucherAssetsQr.md b/docs/VoucherAssetsQr.md new file mode 100644 index 00000000..c079faa5 --- /dev/null +++ b/docs/VoucherAssetsQr.md @@ -0,0 +1,9 @@ +# VoucherifySdk::VoucherAssetsQr + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Encrypted voucher code ID. | [optional] | +| **url** | **String** | URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] | + diff --git a/docs/VoucherLoyaltyCard.md b/docs/VoucherLoyaltyCard.md index 9f68badb..de9d65bb 100644 --- a/docs/VoucherLoyaltyCard.md +++ b/docs/VoucherLoyaltyCard.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **points** | **Integer** | Total points incurred over lifespan of loyalty card. | [optional] | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | | **balance** | **Integer** | Points available for reward redemption. | [optional] | | **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | | **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | diff --git a/docs/VoucherPublish.md b/docs/VoucherPublish.md index d759f01c..80ffb0ca 100644 --- a/docs/VoucherPublish.md +++ b/docs/VoucherPublish.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | | **count** | **Integer** | Publication events counter. | [optional] | | **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | diff --git a/docs/VoucherRedemption.md b/docs/VoucherRedemption.md index a6fbad97..70d39667 100644 --- a/docs/VoucherRedemption.md +++ b/docs/VoucherRedemption.md @@ -6,8 +6,7 @@ | ---- | ---- | ----------- | ----- | | **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | | **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | -| **redeemed_amount** | **Integer** | Total amount redeemed. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 balance is written as 10000. | [optional] | | **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | -| **object** | **String** | The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | | **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | diff --git a/docs/VoucherTransaction.md b/docs/VoucherTransaction.md index c778f1dd..b371ba63 100644 --- a/docs/VoucherTransaction.md +++ b/docs/VoucherTransaction.md @@ -4,14 +4,14 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique transaction ID. | | -| **source_id** | **String** | The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | | -| **voucher_id** | **String** | Unique voucher ID. | | -| **campaign_id** | **String** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | | -| **source** | **String** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | | -| **reason** | **String** | Reason why the transaction occurred. In case of a redemption, this value is null. | | +| **id** | **String** | Unique transaction ID. | [optional] | +| **source_id** | **String** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | [optional] | +| **voucher_id** | **String** | Unique voucher ID. | [optional] | +| **campaign_id** | **String** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | [optional] | +| **source** | **String** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | [optional] | +| **reason** | **String** | Reason why the transaction occurred. In case of a redemption, this value is null. | [optional] | | **type** | [**LoyaltyCardTransactionsType**](LoyaltyCardTransactionsType.md) | | | -| **details** | [**VoucherTransactionDetails**](VoucherTransactionDetails.md) | | | -| **related_transaction_id** | **String** | The related transaction ID on the receiving card. | | -| **created_at** | **Time** | Timestamp representing the date and time when the transaction was created in ISO 8601 format. | | +| **details** | [**VoucherTransactionDetails**](VoucherTransactionDetails.md) | | [optional] | +| **related_transaction_id** | **String** | The related transaction ID on the receiving card. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. | [optional] | diff --git a/docs/VoucherTransactionDetailsBalance.md b/docs/VoucherTransactionDetailsBalance.md index 93865528..c62de68e 100644 --- a/docs/VoucherTransactionDetailsBalance.md +++ b/docs/VoucherTransactionDetailsBalance.md @@ -4,10 +4,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | The type of voucher whose balance is being adjusted due to the transaction. | [default to 'loyalty_card'] | -| **total** | **Integer** | The available points prior to the transaction. | | -| **object** | **String** | The type of object represented by the JSON. | [default to 'balance'] | -| **points** | **Integer** | The amount of points being used up in the transaction. | | -| **balance** | **Integer** | The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card. | | -| **related_object** | [**VoucherTransactionDetailsBalanceRelatedObject**](VoucherTransactionDetailsBalanceRelatedObject.md) | | | +| **type** | **String** | The type of voucher whose balance is being adjusted due to the transaction. | [optional][default to 'loyalty_card'] | +| **total** | **Integer** | The number of all points accumulated on the card as affected by add or subtract operations. | [optional] | +| **object** | **String** | The type of the object represented by the JSON. | [optional][default to 'balance'] | +| **points** | **Integer** | Points added or subtracted in the transaction. | [optional] | +| **balance** | **Integer** | The available points on the card after the transaction as affected by redemption or rollback. | [optional] | +| **related_object** | [**VoucherTransactionDetailsBalanceRelatedObject**](VoucherTransactionDetailsBalanceRelatedObject.md) | | [optional] | diff --git a/docs/VoucherTransactionDetailsBalanceRelatedObject.md b/docs/VoucherTransactionDetailsBalanceRelatedObject.md index fac080fe..1ed238a7 100644 --- a/docs/VoucherTransactionDetailsBalanceRelatedObject.md +++ b/docs/VoucherTransactionDetailsBalanceRelatedObject.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | | -| **type** | **String** | The object being modified, i.e. voucher. | [default to 'voucher'] | +| **id** | **String** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] | +| **type** | **String** | The object being modified, i.e. voucher. | [optional][default to 'voucher'] | diff --git a/docs/VoucherTransactionDetailsCustomEvent.md b/docs/VoucherTransactionDetailsCustomEvent.md index af432a63..f4fb1e86 100644 --- a/docs/VoucherTransactionDetailsCustomEvent.md +++ b/docs/VoucherTransactionDetailsCustomEvent.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique event ID. | | -| **type** | **String** | Type of custom event. | | +| **id** | **String** | Unique event ID. | [optional] | +| **type** | **String** | Type of custom event. | [optional] | diff --git a/docs/VoucherTransactionDetailsEarningRule.md b/docs/VoucherTransactionDetailsEarningRule.md index 720847e4..12f7d0d9 100644 --- a/docs/VoucherTransactionDetailsEarningRule.md +++ b/docs/VoucherTransactionDetailsEarningRule.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique earning rule ID. | | -| **source** | [**VoucherTransactionDetailsEarningRuleSource**](VoucherTransactionDetailsEarningRuleSource.md) | | | +| **id** | **String** | Unique earning rule ID. | [optional] | +| **source** | [**VoucherTransactionDetailsEarningRuleSource**](VoucherTransactionDetailsEarningRuleSource.md) | | [optional] | diff --git a/docs/VoucherTransactionDetailsEarningRuleSource.md b/docs/VoucherTransactionDetailsEarningRuleSource.md index 108a8f34..93d269d9 100644 --- a/docs/VoucherTransactionDetailsEarningRuleSource.md +++ b/docs/VoucherTransactionDetailsEarningRuleSource.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | | +| **banner** | **String** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] | diff --git a/docs/VoucherTransactionDetailsEvent.md b/docs/VoucherTransactionDetailsEvent.md index 51925067..c145ddf4 100644 --- a/docs/VoucherTransactionDetailsEvent.md +++ b/docs/VoucherTransactionDetailsEvent.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique event ID. | | -| **type** | **String** | Type of event. | | +| **id** | **String** | Unique event ID. | [optional] | +| **type** | **String** | Type of event. | [optional] | diff --git a/docs/VoucherTransactionDetailsEventSchema.md b/docs/VoucherTransactionDetailsEventSchema.md index 9f404316..90594d66 100644 --- a/docs/VoucherTransactionDetailsEventSchema.md +++ b/docs/VoucherTransactionDetailsEventSchema.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique metadata schema ID. | | -| **name** | **String** | Type of custom event. | | +| **id** | **String** | Unique metadata schema ID. | [optional] | +| **name** | **String** | Type of custom event. | [optional] | diff --git a/docs/VoucherTransactionDetailsLoyaltyTier.md b/docs/VoucherTransactionDetailsLoyaltyTier.md index a17c354c..3c5256b9 100644 --- a/docs/VoucherTransactionDetailsLoyaltyTier.md +++ b/docs/VoucherTransactionDetailsLoyaltyTier.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | | | -| **name** | **String** | | | +| **id** | **String** | | [optional] | +| **name** | **String** | | [optional] | diff --git a/docs/VoucherTransactionDetailsOrder.md b/docs/VoucherTransactionDetailsOrder.md index 12b09bf6..b3bd89f8 100644 --- a/docs/VoucherTransactionDetailsOrder.md +++ b/docs/VoucherTransactionDetailsOrder.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique order ID. | | -| **source_id** | **String** | The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | | +| **id** | **String** | Unique order ID. | [optional] | +| **source_id** | **String** | The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | [optional] | diff --git a/docs/VoucherTransactionDetailsRedemption.md b/docs/VoucherTransactionDetailsRedemption.md index cd7c00d9..353ea507 100644 --- a/docs/VoucherTransactionDetailsRedemption.md +++ b/docs/VoucherTransactionDetailsRedemption.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption ID. | | +| **id** | **String** | Unique redemption ID. | [optional] | diff --git a/docs/VoucherTransactionDetailsReward.md b/docs/VoucherTransactionDetailsReward.md index 19541be1..969ae397 100644 --- a/docs/VoucherTransactionDetailsReward.md +++ b/docs/VoucherTransactionDetailsReward.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique reward ID. | | -| **name** | **String** | Reward name. | | +| **id** | **String** | Unique reward ID. | [optional] | +| **name** | **String** | Reward name. | [optional] | diff --git a/docs/VoucherTransactionDetailsRollback.md b/docs/VoucherTransactionDetailsRollback.md index ee9e3a3e..e1f57fe3 100644 --- a/docs/VoucherTransactionDetailsRollback.md +++ b/docs/VoucherTransactionDetailsRollback.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique redemption rollback ID. | | +| **id** | **String** | Unique redemption rollback ID. | [optional] | diff --git a/docs/VoucherTransactionDetailsSegment.md b/docs/VoucherTransactionDetailsSegment.md index 92f4ab15..1f206d06 100644 --- a/docs/VoucherTransactionDetailsSegment.md +++ b/docs/VoucherTransactionDetailsSegment.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | | | -| **name** | **String** | | | +| **id** | **String** | | [optional] | +| **name** | **String** | | [optional] | diff --git a/docs/VoucherTransactionsExport.md b/docs/VoucherTransactionsExport.md deleted file mode 100644 index 882085e2..00000000 --- a/docs/VoucherTransactionsExport.md +++ /dev/null @@ -1,16 +0,0 @@ -# VoucherifySdk::VoucherTransactionsExport - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the `export`. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [default to 'API'] | -| **exported_object** | **String** | The type of exported object. | [default to 'voucher_transactions'] | -| **parameters** | [**VoucherTransactionsFilters**](VoucherTransactionsFilters.md) | | | -| **result** | [**VoucherTransactionsExportResult**](VoucherTransactionsExportResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. | | - diff --git a/docs/VoucherTransactionsExportFilterConditions.md b/docs/VoucherTransactionsExportFilterConditions.md index a77447df..3fe20f0f 100644 --- a/docs/VoucherTransactionsExportFilterConditions.md +++ b/docs/VoucherTransactionsExportFilterConditions.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **voucher_id** | [**VoucherTransactionsExportFilterConditionsVoucherId**](VoucherTransactionsExportFilterConditionsVoucherId.md) | | | +| **voucher_id** | [**VoucherTransactionsExportFilterConditionsVoucherId**](VoucherTransactionsExportFilterConditionsVoucherId.md) | | [optional] | diff --git a/docs/VoucherTransactionsExportFilterConditionsVoucherId.md b/docs/VoucherTransactionsExportFilterConditionsVoucherId.md index ec59238d..3948c728 100644 --- a/docs/VoucherTransactionsExportFilterConditionsVoucherId.md +++ b/docs/VoucherTransactionsExportFilterConditionsVoucherId.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **conditions** | [**VoucherTransactionsExportFilterConditionsVoucherIdConditions**](VoucherTransactionsExportFilterConditionsVoucherIdConditions.md) | | | +| **conditions** | [**VoucherTransactionsExportFilterConditionsVoucherIdConditions**](VoucherTransactionsExportFilterConditionsVoucherIdConditions.md) | | [optional] | diff --git a/docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md b/docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md index d3924b1a..123da2ca 100644 --- a/docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md +++ b/docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **_in** | **Array<String>** | | | +| **_in** | **Array<String>** | | [optional] | diff --git a/docs/VoucherTransactionsExportParameters.md b/docs/VoucherTransactionsExportParameters.md index 3216064c..f5312c40 100644 --- a/docs/VoucherTransactionsExportParameters.md +++ b/docs/VoucherTransactionsExportParameters.md @@ -5,5 +5,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **order** | **String** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] | -| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL` <br> - `POINTS_CANCELLATION` <br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL` <br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] | diff --git a/docs/VoucherTransactionsExportResult.md b/docs/VoucherTransactionsExportResult.md deleted file mode 100644 index 0b7abe98..00000000 --- a/docs/VoucherTransactionsExportResult.md +++ /dev/null @@ -1,8 +0,0 @@ -# VoucherifySdk::VoucherTransactionsExportResult - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **url** | **String** | URL of the CSV file location. It contains the `token` used for authorization in the <!-- [Download export](OpenAPI.json/paths/~1exports~1{export_Id}/get) -->[Download export](ref:download-export) method. | | - diff --git a/docs/VoucherTransactionsFilters.md b/docs/VoucherTransactionsFilters.md index a94a4a6a..60c93aeb 100644 --- a/docs/VoucherTransactionsFilters.md +++ b/docs/VoucherTransactionsFilters.md @@ -5,6 +5,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **order** | **String** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] | -| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL` <br> - `POINTS_CANCELLATION` <br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] | +| **fields** | **Array<String>** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL`<br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] | | **filters** | [**VoucherTransactionsExportFilterConditions**](VoucherTransactionsExportFilterConditions.md) | | | diff --git a/docs/VoucherValidityTimeframe.md b/docs/VoucherValidityTimeframe.md deleted file mode 100644 index 16cc3561..00000000 --- a/docs/VoucherValidityTimeframe.md +++ /dev/null @@ -1,9 +0,0 @@ -# VoucherifySdk::VoucherValidityTimeframe - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **duration** | **String** | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour. | [optional] | -| **interval** | **String** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day. | [optional] | - diff --git a/docs/VoucherWithCategories.md b/docs/VoucherWithCategories.md new file mode 100644 index 00000000..e61bf58c --- /dev/null +++ b/docs/VoucherWithCategories.md @@ -0,0 +1,35 @@ +# VoucherifySdk::VoucherWithCategories + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**VoucherWithCategoriesGift**](VoucherWithCategoriesGift.md) | | [optional] | +| **loyalty_card** | [**VoucherWithCategoriesLoyaltyCard**](VoucherWithCategoriesLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**VoucherWithCategoriesPublish**](VoucherWithCategoriesPublish.md) | | [optional] | +| **redemption** | [**VoucherWithCategoriesRedemption**](VoucherWithCategoriesRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | + diff --git a/docs/VoucherWithCategoriesGift.md b/docs/VoucherWithCategoriesGift.md new file mode 100644 index 00000000..c3a7f047 --- /dev/null +++ b/docs/VoucherWithCategoriesGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VoucherWithCategoriesGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/VoucherWithCategoriesLoyaltyCard.md b/docs/VoucherWithCategoriesLoyaltyCard.md new file mode 100644 index 00000000..ac9c4990 --- /dev/null +++ b/docs/VoucherWithCategoriesLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VoucherWithCategoriesLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/VoucherWithCategoriesPublish.md b/docs/VoucherWithCategoriesPublish.md new file mode 100644 index 00000000..c04bd0ce --- /dev/null +++ b/docs/VoucherWithCategoriesPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VoucherWithCategoriesPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/VoucherWithCategoriesRedemption.md b/docs/VoucherWithCategoriesRedemption.md new file mode 100644 index 00000000..cb04fe3f --- /dev/null +++ b/docs/VoucherWithCategoriesRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::VoucherWithCategoriesRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/VouchersApi.md b/docs/VouchersApi.md index 3d7ed2c2..bcc5f9db 100644 --- a/docs/VouchersApi.md +++ b/docs/VouchersApi.md @@ -4,15 +4,84 @@ All URIs are relative to *https://api.voucherify.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**create_voucher**](VouchersApi.md#create_voucher) | **POST** /v1/vouchers/{code} | Create Voucher | | [**delete_voucher**](VouchersApi.md#delete_voucher) | **DELETE** /v1/vouchers/{code} | Delete Voucher | | [**disable_voucher**](VouchersApi.md#disable_voucher) | **POST** /v1/vouchers/{code}/disable | Disable Voucher | | [**enable_voucher**](VouchersApi.md#enable_voucher) | **POST** /v1/vouchers/{code}/enable | Enable Voucher | | [**export_voucher_transactions**](VouchersApi.md#export_voucher_transactions) | **POST** /v1/vouchers/{code}/transactions/export | Export Voucher Transactions | +| [**generate_random_code**](VouchersApi.md#generate_random_code) | **POST** /v1/vouchers | Generate Random Code | | [**get_voucher**](VouchersApi.md#get_voucher) | **GET** /v1/vouchers/{code} | Get Voucher | +| [**import_vouchers**](VouchersApi.md#import_vouchers) | **POST** /v1/vouchers/import | Import Vouchers | | [**import_vouchers_using_csv**](VouchersApi.md#import_vouchers_using_csv) | **POST** /v1/vouchers/importCSV | Import Vouchers using CSV | | [**list_voucher_transactions**](VouchersApi.md#list_voucher_transactions) | **GET** /v1/vouchers/{code}/transactions | List Voucher Transactions | +| [**list_vouchers**](VouchersApi.md#list_vouchers) | **GET** /v1/vouchers | List Vouchers | | [**release_validation_session**](VouchersApi.md#release_validation_session) | **DELETE** /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session | +| [**update_voucher**](VouchersApi.md#update_voucher) | **PUT** /v1/vouchers/{code} | Update Voucher | | [**update_voucher_balance**](VouchersApi.md#update_voucher_balance) | **POST** /v1/vouchers/{code}/balance | Add or Remove Voucher Balance | +| [**update_vouchers_in_bulk**](VouchersApi.md#update_vouchers_in_bulk) | **POST** /v1/vouchers/bulk/async | Update Vouchers in Bulk | +| [**update_vouchers_metadata_in_bulk**](VouchersApi.md#update_vouchers_metadata_in_bulk) | **POST** /v1/vouchers/metadata/async | Update Vouchers' Metadata in Bulk | + + +## create_voucher + +> create_voucher(code, opts) + +Create Voucher + +Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +code = 'code_example' # String | A unique **code** that identifies the voucher. +opts = { + vouchers_create_with_specific_code_request_body: VoucherifySdk::VouchersCreateWithSpecificCodeRequestBody.new # VouchersCreateWithSpecificCodeRequestBody | Specify the details of the voucher that you would like to create. +} + +begin + # Create Voucher + result = api_instance.create_voucher(code, opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->create_voucher: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | A unique **code** that identifies the voucher. | | +| **vouchers_create_with_specific_code_request_body** | [**VouchersCreateWithSpecificCodeRequestBody**](VouchersCreateWithSpecificCodeRequestBody.md) | Specify the details of the voucher that you would like to create. | [optional] | + +### Return type + +[**VouchersCreateResponseBody**](VouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json ## delete_voucher @@ -21,7 +90,7 @@ All URIs are relative to *https://api.voucherify.io* Delete Voucher -Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. +Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. ### Examples @@ -44,7 +113,7 @@ end api_instance = VoucherifySdk::VouchersApi.new code = 'code_example' # String | A unique **code** that identifies the voucher. opts = { - force: true # Boolean | If this flag is set to true, the voucher will be removed permanently. Going forward, the user will be able to create another voucher with exactly the same code. + force: true # Boolean | If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. } begin @@ -60,7 +129,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **code** | **String** | A unique **code** that identifies the voucher. | | -| **force** | **Boolean** | If this flag is set to true, the voucher will be removed permanently. Going forward, the user will be able to create another voucher with exactly the same code. | [optional] | +| **force** | **Boolean** | If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. | [optional] | ### Return type @@ -254,6 +323,66 @@ end - **Accept**: application/json +## generate_random_code + +> generate_random_code(opts) + +Generate Random Code + +Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +opts = { + body: { ... } # Object | Specify the details of the voucher that you would like to create. +} + +begin + # Generate Random Code + result = api_instance.generate_random_code(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->generate_random_code: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | **Object** | Specify the details of the voucher that you would like to create. | [optional] | + +### Return type + +[**VouchersCreateResponseBody**](VouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## get_voucher > get_voucher(code) @@ -312,9 +441,67 @@ end - **Accept**: application/json +## import_vouchers + +> import_vouchers(vouchers_import_create_item_request_body) + +Import Vouchers + +Import standalone vouchers and gift cards into the repository. 📘 Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +vouchers_import_create_item_request_body = [VoucherifySdk::VouchersImportCreateItemRequestBody.new] # Array | The request body is an array of objects. Each object contains details about a specific voucher. + +begin + # Import Vouchers + result = api_instance.import_vouchers(vouchers_import_create_item_request_body) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->import_vouchers: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **vouchers_import_create_item_request_body** | [**Array<VouchersImportCreateItemRequestBody>**](VouchersImportCreateItemRequestBody.md) | The request body is an array of objects. Each object contains details about a specific voucher. | | + +### Return type + +[**VouchersImportCreateResponseBody**](VouchersImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## import_vouchers_using_csv -> import_vouchers_using_csv(file) +> import_vouchers_using_csv(opts) Import Vouchers using CSV @@ -339,11 +526,13 @@ VoucherifySdk.configure do |config| end api_instance = VoucherifySdk::VouchersApi.new -file = File.new('/path/to/some/file') # File | File path. +opts = { + file: File.new('/path/to/some/file') # File | File path. +} begin # Import Vouchers using CSV - result = api_instance.import_vouchers_using_csv(file) + result = api_instance.import_vouchers_using_csv(opts) p result rescue VoucherifySdk::ApiError => e puts "Error when calling VouchersApi->import_vouchers_using_csv: #{e}" @@ -354,7 +543,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **file** | **File** | File path. | | +| **file** | **File** | File path. | [optional] | ### Return type @@ -399,8 +588,8 @@ end api_instance = VoucherifySdk::VouchersApi.new code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. opts = { - limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - page: 56 # Integer | Which page of results to return. + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56 # Integer | Which page of results to return. The lowest value is 1. } begin @@ -417,8 +606,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **code** | **String** | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | | -| **limit** | **Integer** | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] | -| **page** | **Integer** | Which page of results to return. | [optional] | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | ### Return type @@ -434,6 +623,86 @@ end - **Accept**: application/json +## list_vouchers + +> list_vouchers(opts) + +List Vouchers + +Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +opts = { + limit: 56, # Integer | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + page: 56, # Integer | Which page of results to return. The lowest value is 1. + category: 'category_example', # String | Limit search results to vouchers within the specified category. + campaign_id: 'campaign_id_example', # String | Limit search results to vouchers within the specified campaign + customer: 'customer_example', # String | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + campaign: 'campaign_example', # String | A unique campaign name, identifies the parent campaign. + created_at: VoucherifySdk::ParameterCreatedBeforeAfter.new, # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + updated_at: VoucherifySdk::ParameterUpdatedBeforeAfter.new, # ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + order: VoucherifySdk::ParameterOrderVouchers::CREATED_AT, # ParameterOrderVouchers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + code: 'code_example', # String | + ids: ['inner_example'] # Array | +} + +begin + # List Vouchers + result = api_instance.list_vouchers(opts) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->list_vouchers: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **limit** | **Integer** | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **Integer** | Which page of results to return. The lowest value is 1. | [optional] | +| **category** | **String** | Limit search results to vouchers within the specified category. | [optional] | +| **campaign_id** | **String** | Limit search results to vouchers within the specified campaign | [optional] | +| **customer** | **String** | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the parent campaign. | [optional] | +| **created_at** | [**ParameterCreatedBeforeAfter**](.md) | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **updated_at** | [**ParameterUpdatedBeforeAfter**](.md) | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **order** | [**ParameterOrderVouchers**](.md) | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **code** | **String** | | [optional] | +| **ids** | [**Array<String>**](String.md) | | [optional] | + +### Return type + +[**VouchersListResponseBody**](VouchersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## release_validation_session > release_validation_session(code, session_key) @@ -493,6 +762,66 @@ nil (empty response body) - **Accept**: Not defined +## update_voucher + +> update_voucher(code, vouchers_update_request_body) + +Update Voucher + +Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +code = 'code_example' # String | A unique **code** that identifies the voucher. +vouchers_update_request_body = VoucherifySdk::VouchersUpdateRequestBody.new # VouchersUpdateRequestBody | Specify the parameters to be updated. + +begin + # Update Voucher + result = api_instance.update_voucher(code, vouchers_update_request_body) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->update_voucher: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | A unique **code** that identifies the voucher. | | +| **vouchers_update_request_body** | [**VouchersUpdateRequestBody**](VouchersUpdateRequestBody.md) | Specify the parameters to be updated. | | + +### Return type + +[**VouchersUpdateResponseBody**](VouchersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## update_voucher_balance > update_voucher_balance(code, vouchers_balance_update_request_body) @@ -521,7 +850,7 @@ end api_instance = VoucherifySdk::VouchersApi.new code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. -vouchers_balance_update_request_body = VoucherifySdk::VouchersBalanceUpdateRequestBody.new({amount: 37}) # VouchersBalanceUpdateRequestBody | Provide the amount to be added to/subtracted from the voucher. +vouchers_balance_update_request_body = VoucherifySdk::VouchersBalanceUpdateRequestBody.new # VouchersBalanceUpdateRequestBody | Provide the amount to be added to/subtracted from the voucher. begin # Add or Remove Voucher Balance @@ -552,3 +881,119 @@ end - **Content-Type**: application/json - **Accept**: application/json + +## update_vouchers_in_bulk + +> update_vouchers_in_bulk(vouchers_update_in_bulk_item_request_body) + +Update Vouchers in Bulk + +Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. 🚧 Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +vouchers_update_in_bulk_item_request_body = [VoucherifySdk::VouchersUpdateInBulkItemRequestBody.new] # Array | List the codes to be updated with the metadata key/value pairs for that code. + +begin + # Update Vouchers in Bulk + result = api_instance.update_vouchers_in_bulk(vouchers_update_in_bulk_item_request_body) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->update_vouchers_in_bulk: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **vouchers_update_in_bulk_item_request_body** | [**Array<VouchersUpdateInBulkItemRequestBody>**](VouchersUpdateInBulkItemRequestBody.md) | List the codes to be updated with the metadata key/value pairs for that code. | | + +### Return type + +[**VouchersUpdateInBulkResponseBody**](VouchersUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## update_vouchers_metadata_in_bulk + +> update_vouchers_metadata_in_bulk(vouchers_metadata_update_in_bulk_request_body) + +Update Vouchers' Metadata in Bulk + +Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Examples + +```ruby +require 'time' +require 'VoucherifySdk' +# setup authorization +VoucherifySdk.configure do |config| + # Configure API key authorization: X-App-Id + config.api_key['X-App-Id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Id'] = 'Bearer' + + # Configure API key authorization: X-App-Token + config.api_key['X-App-Token'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['X-App-Token'] = 'Bearer' +end + +api_instance = VoucherifySdk::VouchersApi.new +vouchers_metadata_update_in_bulk_request_body = VoucherifySdk::VouchersMetadataUpdateInBulkRequestBody.new # VouchersMetadataUpdateInBulkRequestBody | List the codes of the vouchers you would like to update with the metadata key/value pairs. + +begin + # Update Vouchers' Metadata in Bulk + result = api_instance.update_vouchers_metadata_in_bulk(vouchers_metadata_update_in_bulk_request_body) + p result +rescue VoucherifySdk::ApiError => e + puts "Error when calling VouchersApi->update_vouchers_metadata_in_bulk: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **vouchers_metadata_update_in_bulk_request_body** | [**VouchersMetadataUpdateInBulkRequestBody**](VouchersMetadataUpdateInBulkRequestBody.md) | List the codes of the vouchers you would like to update with the metadata key/value pairs. | | + +### Return type + +[**VouchersMetadataUpdateInBulkResponseBody**](VouchersMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/VouchersBalanceUpdateRequestBody.md b/docs/VouchersBalanceUpdateRequestBody.md index f6ed0e5d..764e9512 100644 --- a/docs/VouchersBalanceUpdateRequestBody.md +++ b/docs/VouchersBalanceUpdateRequestBody.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **amount** | **Integer** | The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000. | | -| **source_id** | **String** | The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] | +| **amount** | **Integer** | The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000. | [optional] | +| **source_id** | **String** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] | | **reason** | **String** | Reason why the transaction occurred. | [optional] | diff --git a/docs/VouchersBalanceUpdateResponseBody.md b/docs/VouchersBalanceUpdateResponseBody.md index 0e9b975a..7caf92d6 100644 --- a/docs/VouchersBalanceUpdateResponseBody.md +++ b/docs/VouchersBalanceUpdateResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **amount** | **Integer** | The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | | -| **total** | **Integer** | Total income incurred over the lifespan of the gift card or loyalty card. | | -| **balance** | **Integer** | The balance after adding or subtracting a specified amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | | -| **type** | **String** | The type of voucher being modified. | | -| **operation_type** | **String** | | [default to 'MANUAL'] | -| **object** | **String** | The type of object represented by JSON. Default is `balance`. | [default to 'balance'] | -| **related_object** | [**VouchersBalanceUpdateResponseBodyRelatedObject**](VouchersBalanceUpdateResponseBodyRelatedObject.md) | | | +| **amount** | **Integer** | The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **total** | **Integer** | Total income incurred over the lifespan of the gift card or loyalty card. | [optional] | +| **balance** | **Integer** | The balance after adding or subtracting a specified amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **type** | **String** | The type of voucher being modified. | [optional] | +| **operation_type** | **String** | | [optional][default to 'MANUAL'] | +| **object** | **String** | The type of the object represented by JSON. Default is `balance`. | [optional][default to 'balance'] | +| **related_object** | [**VouchersBalanceUpdateResponseBodyRelatedObject**](VouchersBalanceUpdateResponseBodyRelatedObject.md) | | [optional] | diff --git a/docs/VouchersBalanceUpdateResponseBodyRelatedObject.md b/docs/VouchersBalanceUpdateResponseBodyRelatedObject.md index b9795ca0..a3f1308a 100644 --- a/docs/VouchersBalanceUpdateResponseBodyRelatedObject.md +++ b/docs/VouchersBalanceUpdateResponseBodyRelatedObject.md @@ -4,6 +4,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | The object being modified, i.e. `voucher`. | [default to 'voucher'] | -| **id** | **String** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | | +| **type** | **String** | The object being modified, i.e. `voucher`. | [optional][default to 'voucher'] | +| **id** | **String** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] | diff --git a/docs/VouchersCreateResponseBody.md b/docs/VouchersCreateResponseBody.md new file mode 100644 index 00000000..b12cf65f --- /dev/null +++ b/docs/VouchersCreateResponseBody.md @@ -0,0 +1,36 @@ +# VoucherifySdk::VouchersCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**VouchersCreateResponseBodyGift**](VouchersCreateResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**VouchersCreateResponseBodyLoyaltyCard**](VouchersCreateResponseBodyLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**VouchersCreateResponseBodyPublish**](VouchersCreateResponseBodyPublish.md) | | [optional] | +| **redemption** | [**VouchersCreateResponseBodyRedemption**](VouchersCreateResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | + diff --git a/docs/VouchersCreateResponseBodyGift.md b/docs/VouchersCreateResponseBodyGift.md new file mode 100644 index 00000000..a305fa44 --- /dev/null +++ b/docs/VouchersCreateResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersCreateResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/VouchersCreateResponseBodyLoyaltyCard.md b/docs/VouchersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..4ca8aa52 --- /dev/null +++ b/docs/VouchersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VouchersCreateResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/VouchersCreateResponseBodyPublish.md b/docs/VouchersCreateResponseBodyPublish.md new file mode 100644 index 00000000..a70a9b4b --- /dev/null +++ b/docs/VouchersCreateResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersCreateResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/VouchersCreateResponseBodyRedemption.md b/docs/VouchersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..166acb0a --- /dev/null +++ b/docs/VouchersCreateResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::VouchersCreateResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/VouchersCreateWithSpecificCodeRequestBody.md b/docs/VouchersCreateWithSpecificCodeRequestBody.md new file mode 100644 index 00000000..fe7f7e55 --- /dev/null +++ b/docs/VouchersCreateWithSpecificCodeRequestBody.md @@ -0,0 +1,25 @@ +# VoucherifySdk::VouchersCreateWithSpecificCodeRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **campaign** | **String** | Identifies the voucher's parent campaign using a unique campaign name. | [optional] | +| **campaign_id** | **String** | Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API. | [optional] | +| **category** | **String** | The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] | +| **category_id** | **String** | Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] | +| **start_date** | **Time** | Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | | [optional] | +| **validation_rules** | **Array<String>** | Array containing the ID of the validation rule associated with the voucher. | [optional] | +| **redemption** | [**VouchersCreateWithSpecificCodeRequestBodyRedemption**](VouchersCreateWithSpecificCodeRequestBodyRedemption.md) | | [optional] | +| **type** | **String** | | [optional] | +| **loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] | +| **gift** | [**Gift**](Gift.md) | | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md b/docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md new file mode 100644 index 00000000..3f5f9b39 --- /dev/null +++ b/docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::VouchersCreateWithSpecificCodeRequestBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | + diff --git a/docs/VouchersDisableResponseBody.md b/docs/VouchersDisableResponseBody.md index 0698724e..f40c4dcd 100644 --- a/docs/VouchersDisableResponseBody.md +++ b/docs/VouchersDisableResponseBody.md @@ -10,28 +10,27 @@ | **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | | **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | | **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **type** | **String** | Defines the type of the voucher. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | -| **gift** | [**VoucherGift**](VoucherGift.md) | | [optional] | -| **loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] | +| **gift** | [**VouchersDisableResponseBodyGift**](VouchersDisableResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**VouchersDisableResponseBodyLoyaltyCard**](VouchersDisableResponseBodyLoyaltyCard.md) | | [optional] | | **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**VoucherValidityTimeframe**](VoucherValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | | **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | | **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | -| **distributions** | **Array<Object>** | | [optional] | -| **deleted** | **Boolean** | Flag indicating whether this voucher is deleted. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**VouchersDisableResponseBodyPublish**](VouchersDisableResponseBodyPublish.md) | | [optional] | +| **redemption** | [**VouchersDisableResponseBodyRedemption**](VouchersDisableResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | -| **publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] | -| **redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] | diff --git a/docs/VouchersDisableResponseBodyGift.md b/docs/VouchersDisableResponseBodyGift.md new file mode 100644 index 00000000..3e972960 --- /dev/null +++ b/docs/VouchersDisableResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersDisableResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/VouchersDisableResponseBodyLoyaltyCard.md b/docs/VouchersDisableResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..3b408245 --- /dev/null +++ b/docs/VouchersDisableResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VouchersDisableResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/VouchersDisableResponseBodyPublish.md b/docs/VouchersDisableResponseBodyPublish.md new file mode 100644 index 00000000..422154f8 --- /dev/null +++ b/docs/VouchersDisableResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersDisableResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/VouchersDisableResponseBodyRedemption.md b/docs/VouchersDisableResponseBodyRedemption.md new file mode 100644 index 00000000..ba34b30e --- /dev/null +++ b/docs/VouchersDisableResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::VouchersDisableResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/VouchersEnableResponseBody.md b/docs/VouchersEnableResponseBody.md index 844adc5c..460a7e6f 100644 --- a/docs/VouchersEnableResponseBody.md +++ b/docs/VouchersEnableResponseBody.md @@ -10,28 +10,27 @@ | **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | | **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | | **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **type** | **String** | Defines the type of the voucher. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | -| **gift** | [**VoucherGift**](VoucherGift.md) | | [optional] | -| **loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] | +| **gift** | [**VouchersEnableResponseBodyGift**](VouchersEnableResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**VouchersEnableResponseBodyLoyaltyCard**](VouchersEnableResponseBodyLoyaltyCard.md) | | [optional] | | **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**VoucherValidityTimeframe**](VoucherValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | | **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | | **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | -| **distributions** | **Array<Object>** | | [optional] | -| **deleted** | **Boolean** | Flag indicating whether this voucher is deleted. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**VouchersEnableResponseBodyPublish**](VouchersEnableResponseBodyPublish.md) | | [optional] | +| **redemption** | [**VouchersEnableResponseBodyRedemption**](VouchersEnableResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | -| **publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] | -| **redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] | diff --git a/docs/VouchersEnableResponseBodyGift.md b/docs/VouchersEnableResponseBodyGift.md new file mode 100644 index 00000000..5cff4baa --- /dev/null +++ b/docs/VouchersEnableResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersEnableResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/VouchersEnableResponseBodyLoyaltyCard.md b/docs/VouchersEnableResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..d8da755c --- /dev/null +++ b/docs/VouchersEnableResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VouchersEnableResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/VouchersEnableResponseBodyPublish.md b/docs/VouchersEnableResponseBodyPublish.md new file mode 100644 index 00000000..aaefdc46 --- /dev/null +++ b/docs/VouchersEnableResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersEnableResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/VouchersEnableResponseBodyRedemption.md b/docs/VouchersEnableResponseBodyRedemption.md new file mode 100644 index 00000000..2d0e709d --- /dev/null +++ b/docs/VouchersEnableResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::VouchersEnableResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/VouchersGetResponseBody.md b/docs/VouchersGetResponseBody.md index ffe34cc9..83008eb3 100644 --- a/docs/VouchersGetResponseBody.md +++ b/docs/VouchersGetResponseBody.md @@ -10,28 +10,27 @@ | **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | | **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | | **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | -| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **type** | **String** | Defines the type of the voucher. | [optional] | | **discount** | [**Discount**](Discount.md) | | [optional] | -| **gift** | [**VoucherGift**](VoucherGift.md) | | [optional] | -| **loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] | +| **gift** | [**VouchersGetResponseBodyGift**](VouchersGetResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**VouchersGetResponseBodyLoyaltyCard**](VouchersGetResponseBodyLoyaltyCard.md) | | [optional] | | **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | | **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | -| **validity_timeframe** | [**VoucherValidityTimeframe**](VoucherValidityTimeframe.md) | | [optional] | -| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | | **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | | **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | | **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | | **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | | **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | -| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created in ISO 8601 format. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | | **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | -| **holder_id** | **String** | Unique customer ID of voucher owner. | [optional] | -| **holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] | -| **object** | **String** | The type of object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | -| **distributions** | **Array<Object>** | | [optional] | -| **deleted** | **Boolean** | Flag indicating whether this voucher is deleted. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**VouchersGetResponseBodyPublish**](VouchersGetResponseBodyPublish.md) | | [optional] | +| **redemption** | [**VouchersGetResponseBodyRedemption**](VouchersGetResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | | **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | -| **publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] | -| **redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] | diff --git a/docs/VouchersGetResponseBodyGift.md b/docs/VouchersGetResponseBodyGift.md new file mode 100644 index 00000000..a60f164e --- /dev/null +++ b/docs/VouchersGetResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersGetResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/VouchersGetResponseBodyLoyaltyCard.md b/docs/VouchersGetResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..d6e81377 --- /dev/null +++ b/docs/VouchersGetResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VouchersGetResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/VouchersGetResponseBodyPublish.md b/docs/VouchersGetResponseBodyPublish.md new file mode 100644 index 00000000..11f0483f --- /dev/null +++ b/docs/VouchersGetResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersGetResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/VouchersGetResponseBodyRedemption.md b/docs/VouchersGetResponseBodyRedemption.md new file mode 100644 index 00000000..82c230ad --- /dev/null +++ b/docs/VouchersGetResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::VouchersGetResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/docs/VouchersImportCreateItemRequestBody.md b/docs/VouchersImportCreateItemRequestBody.md new file mode 100644 index 00000000..e3b8a346 --- /dev/null +++ b/docs/VouchersImportCreateItemRequestBody.md @@ -0,0 +1,20 @@ +# VoucherifySdk::VouchersImportCreateItemRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | Value representing the imported code. | [optional] | +| **redemption** | [**VouchersImportCreateItemRequestBodyRedemption**](VouchersImportCreateItemRequestBodyRedemption.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **metadata** | **Object** | | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. | [optional] | +| **start_date** | **Time** | Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] | +| **expiration_date** | **Time** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **type** | **String** | | [optional] | +| **gift** | [**Gift**](Gift.md) | | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/VouchersImportCreateItemRequestBodyRedemption.md b/docs/VouchersImportCreateItemRequestBodyRedemption.md new file mode 100644 index 00000000..3c446012 --- /dev/null +++ b/docs/VouchersImportCreateItemRequestBodyRedemption.md @@ -0,0 +1,8 @@ +# VoucherifySdk::VouchersImportCreateItemRequestBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | + diff --git a/docs/VouchersImportCreateResponseBody.md b/docs/VouchersImportCreateResponseBody.md new file mode 100644 index 00000000..4ff1da8f --- /dev/null +++ b/docs/VouchersImportCreateResponseBody.md @@ -0,0 +1,8 @@ +# VoucherifySdk::VouchersImportCreateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | + diff --git a/docs/VouchersImportCsvCreateResponseBody.md b/docs/VouchersImportCsvCreateResponseBody.md index d4369a12..90731612 100644 --- a/docs/VouchersImportCsvCreateResponseBody.md +++ b/docs/VouchersImportCsvCreateResponseBody.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | diff --git a/docs/VouchersListResponseBody.md b/docs/VouchersListResponseBody.md new file mode 100644 index 00000000..1ec0f4a9 --- /dev/null +++ b/docs/VouchersListResponseBody.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VouchersListResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of voucher objects. | [optional][default to 'vouchers'] | +| **vouchers** | [**Array<VoucherWithCategories>**](VoucherWithCategories.md) | A dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. | [optional] | +| **total** | **Integer** | Returns how many vouchers in the project meet the limits defined by the query parameter definitions. | [optional] | + diff --git a/docs/VouchersMetadataUpdateInBulkRequestBody.md b/docs/VouchersMetadataUpdateInBulkRequestBody.md new file mode 100644 index 00000000..e1fa9fe8 --- /dev/null +++ b/docs/VouchersMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,9 @@ +# VoucherifySdk::VouchersMetadataUpdateInBulkRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **codes** | **Array<String>** | An array of voucher codes. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | + diff --git a/docs/VouchersMetadataUpdateInBulkResponseBody.md b/docs/VouchersMetadataUpdateInBulkResponseBody.md new file mode 100644 index 00000000..cdff428b --- /dev/null +++ b/docs/VouchersMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,8 @@ +# VoucherifySdk::VouchersMetadataUpdateInBulkResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | + diff --git a/docs/VouchersRedemptionGetResponseBody.md b/docs/VouchersRedemptionGetResponseBody.md index a6b9ee0e..02f4c514 100644 --- a/docs/VouchersRedemptionGetResponseBody.md +++ b/docs/VouchersRedemptionGetResponseBody.md @@ -4,11 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **quantity** | **Integer** | The maximum number of times a voucher can be redeemed. | | -| **redeemed_quantity** | **Integer** | The number of times the voucher was redeemed successfully. | | -| **object** | **String** | The type of object represented by JSON. This object stores information about redemptions in a dictionary. | [default to 'list'] | -| **url** | **String** | URL | | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of `redemption_entries`. | [default to 'redemption_entries'] | -| **total** | **Integer** | Total number of redemption objects. | | -| **redemption_entries** | [**Array<VouchersRedemptionGetResponseBodyRedemptionEntriesItem>**](VouchersRedemptionGetResponseBodyRedemptionEntriesItem.md) | Contains the array of successful and failed redemption objects. | | +| **quantity** | **Integer** | The maximum number of times a voucher can be redeemed. | [optional] | +| **redeemed_quantity** | **Integer** | The number of times the voucher was redeemed successfully. | [optional] | +| **object** | **String** | The type of the object represented by JSON. This object stores information about redemptions in a dictionary. | [optional][default to 'list'] | +| **url** | **String** | URL | [optional] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of `redemption_entries`. | [optional][default to 'redemption_entries'] | +| **total** | **Integer** | Total number of redemption objects. | [optional] | +| **redemption_entries** | [**Array<RedemptionEntry>**](RedemptionEntry.md) | Contains the array of successful and failed redemption objects. | | diff --git a/docs/VouchersRedemptionGetResponseBodyRedemptionEntriesItem.md b/docs/VouchersRedemptionGetResponseBodyRedemptionEntriesItem.md deleted file mode 100644 index 691c8e35..00000000 --- a/docs/VouchersRedemptionGetResponseBodyRedemptionEntriesItem.md +++ /dev/null @@ -1,49 +0,0 @@ -# VoucherifySdk::VouchersRedemptionGetResponseBodyRedemptionEntriesItem - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::VouchersRedemptionGetResponseBodyRedemptionEntriesItem.openapi_one_of -# => -# [ -# :'Redemption', -# :'RedemptionRollback' -# ] -``` - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require 'VoucherifySdk' - -VoucherifySdk::VouchersRedemptionGetResponseBodyRedemptionEntriesItem.build(data) -# => # - -VoucherifySdk::VouchersRedemptionGetResponseBodyRedemptionEntriesItem.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -- `Redemption` -- `RedemptionRollback` -- `nil` (if no type matches) - diff --git a/docs/VouchersTransactionsExportCreateResponseBody.md b/docs/VouchersTransactionsExportCreateResponseBody.md index 3f0b0046..4e6a1014 100644 --- a/docs/VouchersTransactionsExportCreateResponseBody.md +++ b/docs/VouchersTransactionsExportCreateResponseBody.md @@ -4,13 +4,13 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | Unique export ID. | | -| **object** | **String** | The type of object being represented. This object stores information about the `export`. | [default to 'export'] | -| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | | -| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [default to 'SCHEDULED'] | -| **channel** | **String** | The channel through which the export was triggered. | [default to 'API'] | -| **exported_object** | **String** | The type of exported object. | [default to 'voucher_transactions'] | +| **id** | **String** | Unique export ID. | [optional] | +| **object** | **String** | The type of object being represented. This object stores information about the `export`. | [optional][default to 'export'] | +| **created_at** | **Time** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] | +| **status** | **String** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional][default to 'SCHEDULED'] | +| **channel** | **String** | The channel through which the export was triggered. | [optional][default to 'API'] | +| **exported_object** | **String** | The type of exported object. | [optional][default to 'voucher_transactions'] | | **parameters** | [**VoucherTransactionsFilters**](VoucherTransactionsFilters.md) | | | -| **result** | [**VoucherTransactionsExportResult**](VoucherTransactionsExportResult.md) | | | -| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. | | +| **result** | [**VouchersTransactionsExportCreateResponseBodyResult**](VouchersTransactionsExportCreateResponseBodyResult.md) | | [optional] | +| **user_id** | **String** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. | [optional] | diff --git a/docs/VouchersTransactionsExportCreateResponseBodyResult.md b/docs/VouchersTransactionsExportCreateResponseBodyResult.md new file mode 100644 index 00000000..88bb401c --- /dev/null +++ b/docs/VouchersTransactionsExportCreateResponseBodyResult.md @@ -0,0 +1,8 @@ +# VoucherifySdk::VouchersTransactionsExportCreateResponseBodyResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | URL of the CSV file location. It contains the `token` used for authorization in the <!-- [Download export](OpenAPI.json/paths/~1exports~1{export_Id}/get) -->[Download export](ref:download-export) method. | [optional] | + diff --git a/docs/VouchersTransactionsListResponseBody.md b/docs/VouchersTransactionsListResponseBody.md index 2e04b8b5..4bb9b0f9 100644 --- a/docs/VouchersTransactionsListResponseBody.md +++ b/docs/VouchersTransactionsListResponseBody.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **object** | **String** | The type of object represented by JSON. | [default to 'list'] | -| **data_ref** | **String** | Identifies the name of the attribute that contains the array of transaction objects. | [default to 'data'] | -| **data** | [**Array<VoucherTransaction>**](VoucherTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | | -| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. | | +| **object** | **String** | The type of the object represented by JSON. | [optional][default to 'list'] | +| **data_ref** | **String** | Identifies the name of the attribute that contains the array of transaction objects. | [optional][default to 'data'] | +| **data** | [**Array<VoucherTransaction>**](VoucherTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | [optional] | +| **has_more** | **Boolean** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [optional] | diff --git a/docs/VouchersUpdateInBulkItemRequestBody.md b/docs/VouchersUpdateInBulkItemRequestBody.md new file mode 100644 index 00000000..01257361 --- /dev/null +++ b/docs/VouchersUpdateInBulkItemRequestBody.md @@ -0,0 +1,9 @@ +# VoucherifySdk::VouchersUpdateInBulkItemRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | Unique voucher code. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | + diff --git a/docs/VouchersUpdateInBulkResponseBody.md b/docs/VouchersUpdateInBulkResponseBody.md new file mode 100644 index 00000000..cd94e4b6 --- /dev/null +++ b/docs/VouchersUpdateInBulkResponseBody.md @@ -0,0 +1,8 @@ +# VoucherifySdk::VouchersUpdateInBulkResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **async_action_id** | **String** | The ID of the scheduled asynchronous action. | [optional] | + diff --git a/docs/VouchersUpdateRequestBody.md b/docs/VouchersUpdateRequestBody.md new file mode 100644 index 00000000..56139e2b --- /dev/null +++ b/docs/VouchersUpdateRequestBody.md @@ -0,0 +1,21 @@ +# VoucherifySdk::VouchersUpdateRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **category** | **String** | The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] | +| **category_id** | **String** | Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] | +| **start_date** | **Time** | Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | | [optional] | +| **type** | **String** | | [optional] | +| **loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] | +| **gift** | [**Gift**](Gift.md) | | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | + diff --git a/docs/VouchersUpdateResponseBody.md b/docs/VouchersUpdateResponseBody.md new file mode 100644 index 00000000..9cb99508 --- /dev/null +++ b/docs/VouchersUpdateResponseBody.md @@ -0,0 +1,36 @@ +# VoucherifySdk::VouchersUpdateResponseBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Assigned by the Voucherify API, identifies the voucher. | [optional] | +| **code** | **String** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] | +| **campaign** | **String** | A unique campaign name, identifies the voucher's parent campaign. | [optional] | +| **campaign_id** | **String** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] | +| **category** | **String** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] | +| **category_id** | **String** | Unique category ID assigned by Voucherify. | [optional] | +| **type** | **String** | Defines the type of the voucher. | [optional] | +| **discount** | [**Discount**](Discount.md) | | [optional] | +| **gift** | [**VouchersUpdateResponseBodyGift**](VouchersUpdateResponseBodyGift.md) | | [optional] | +| **loyalty_card** | [**VouchersUpdateResponseBodyLoyaltyCard**](VouchersUpdateResponseBodyLoyaltyCard.md) | | [optional] | +| **start_date** | **Time** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] | +| **expiration_date** | **Time** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] | +| **validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] | +| **validity_day_of_week** | **Array<Integer>** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] | +| **validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] | +| **active** | **Boolean** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] | +| **additional_info** | **String** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] | +| **metadata** | **Object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] | +| **assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] | +| **is_referral_code** | **Boolean** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] | +| **created_at** | **Time** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] | +| **updated_at** | **Time** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] | +| **holder_id** | **String** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] | +| **referrer_id** | **String** | Unique identifier of the referring person. | [optional] | +| **object** | **String** | The type of the object represented by JSON. Default is `voucher`. | [optional][default to 'voucher'] | +| **publish** | [**VouchersUpdateResponseBodyPublish**](VouchersUpdateResponseBodyPublish.md) | | [optional] | +| **redemption** | [**VouchersUpdateResponseBodyRedemption**](VouchersUpdateResponseBodyRedemption.md) | | [optional] | +| **categories** | [**Array<Category>**](Category.md) | Contains details about the category. | [optional] | +| **validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] | + diff --git a/docs/VouchersUpdateResponseBodyGift.md b/docs/VouchersUpdateResponseBodyGift.md new file mode 100644 index 00000000..31137a61 --- /dev/null +++ b/docs/VouchersUpdateResponseBodyGift.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersUpdateResponseBodyGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **balance** | **Integer** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] | +| **effect** | **String** | Defines how the credits are applied to the customer's order. | [optional] | + diff --git a/docs/VouchersUpdateResponseBodyLoyaltyCard.md b/docs/VouchersUpdateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..16c53f0e --- /dev/null +++ b/docs/VouchersUpdateResponseBodyLoyaltyCard.md @@ -0,0 +1,11 @@ +# VoucherifySdk::VouchersUpdateResponseBodyLoyaltyCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **points** | **Integer** | Total points incurred over the lifespan of the loyalty card. | [optional] | +| **balance** | **Integer** | Points available for reward redemption. | [optional] | +| **next_expiration_date** | **Date** | The next closest date when the next set of points are due to expire. | [optional] | +| **next_expiration_points** | **Integer** | The amount of points that are set to expire next. | [optional] | + diff --git a/docs/VouchersUpdateResponseBodyPublish.md b/docs/VouchersUpdateResponseBodyPublish.md new file mode 100644 index 00000000..3206da47 --- /dev/null +++ b/docs/VouchersUpdateResponseBodyPublish.md @@ -0,0 +1,10 @@ +# VoucherifySdk::VouchersUpdateResponseBodyPublish + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional][default to 'list'] | +| **count** | **Integer** | Publication events counter. | [optional] | +| **url** | **String** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] | + diff --git a/docs/VouchersUpdateResponseBodyRedemption.md b/docs/VouchersUpdateResponseBodyRedemption.md new file mode 100644 index 00000000..45b7d55a --- /dev/null +++ b/docs/VouchersUpdateResponseBodyRedemption.md @@ -0,0 +1,12 @@ +# VoucherifySdk::VouchersUpdateResponseBodyRedemption + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Integer** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] | +| **redeemed_quantity** | **Integer** | How many times a voucher has already been redeemed. | [optional] | +| **redeemed_points** | **Integer** | Total loyalty points redeemed. | [optional] | +| **object** | **String** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional][default to 'list'] | +| **url** | **String** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] | + diff --git a/lib/VoucherifySdk.rb b/lib/VoucherifySdk.rb index 957e560c..75ae4136 100644 --- a/lib/VoucherifySdk.rb +++ b/lib/VoucherifySdk.rb @@ -17,56 +17,51 @@ require 'VoucherifySdk/configuration' # Models -require 'VoucherifySdk/models/any' +require 'VoucherifySdk/models/access_settings_campaign_assignments_list' require 'VoucherifySdk/models/applicable_to' require 'VoucherifySdk/models/applicable_to_effect' require 'VoucherifySdk/models/applicable_to_result_list' -require 'VoucherifySdk/models/array_inner' -require 'VoucherifySdk/models/async_actions' +require 'VoucherifySdk/models/area_store_campaign_assignment' +require 'VoucherifySdk/models/async_action_base' +require 'VoucherifySdk/models/async_action_get_response_body' +require 'VoucherifySdk/models/async_actions_list_response_body' require 'VoucherifySdk/models/bus_val_rule_assignment' -require 'VoucherifySdk/models/campaign' require 'VoucherifySdk/models/campaign_base' -require 'VoucherifySdk/models/campaign_base_validity_timeframe' require 'VoucherifySdk/models/campaign_loyalty_card' require 'VoucherifySdk/models/campaign_loyalty_card_expiration_rules' require 'VoucherifySdk/models/campaign_loyalty_voucher' require 'VoucherifySdk/models/campaign_loyalty_voucher_redemption' require 'VoucherifySdk/models/campaign_voucher' require 'VoucherifySdk/models/campaign_voucher_redemption' -require 'VoucherifySdk/models/campaigns_create_base' -require 'VoucherifySdk/models/campaigns_create_discount_coupons_campaign' -require 'VoucherifySdk/models/campaigns_create_gift_campaign' -require 'VoucherifySdk/models/campaigns_create_giveaway_campaign' -require 'VoucherifySdk/models/campaigns_create_loyalty_campaign' -require 'VoucherifySdk/models/campaigns_create_promotion_campaign' -require 'VoucherifySdk/models/campaigns_create_referral_campaign' require 'VoucherifySdk/models/campaigns_create_request_body' +require 'VoucherifySdk/models/campaigns_create_request_body_promotion' +require 'VoucherifySdk/models/campaigns_create_request_body_voucher' +require 'VoucherifySdk/models/campaigns_create_request_body_voucher_redemption' require 'VoucherifySdk/models/campaigns_create_response_body' require 'VoucherifySdk/models/campaigns_delete_response_body' -require 'VoucherifySdk/models/campaigns_disable_response_body' -require 'VoucherifySdk/models/campaigns_enable_response_body' require 'VoucherifySdk/models/campaigns_get_response_body' require 'VoucherifySdk/models/campaigns_import_create_response_body' require 'VoucherifySdk/models/campaigns_import_csv_create_response_body' require 'VoucherifySdk/models/campaigns_import_voucher_item' require 'VoucherifySdk/models/campaigns_import_voucher_item_redemption' -require 'VoucherifySdk/models/campaigns_import_voucher_loyalty_card' require 'VoucherifySdk/models/campaigns_list_response_body' -require 'VoucherifySdk/models/campaigns_update_base' -require 'VoucherifySdk/models/campaigns_update_coupon_campaign_base' -require 'VoucherifySdk/models/campaigns_update_discount_coupons_campaign' -require 'VoucherifySdk/models/campaigns_update_gift_campaign' -require 'VoucherifySdk/models/campaigns_update_giveaway_campaign' -require 'VoucherifySdk/models/campaigns_update_loyalty_campaign' -require 'VoucherifySdk/models/campaigns_update_promotion_campaign' -require 'VoucherifySdk/models/campaigns_update_referral_campaign' require 'VoucherifySdk/models/campaigns_update_request_body' +require 'VoucherifySdk/models/campaigns_update_request_body_options' require 'VoucherifySdk/models/campaigns_update_response_body' -require 'VoucherifySdk/models/campaigns_vouchers_create_base_request_body' +require 'VoucherifySdk/models/campaigns_vouchers_create_combined_response_body' +require 'VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_gift' +require 'VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_loyalty_card' +require 'VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_publish' +require 'VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_redemption' require 'VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body' -require 'VoucherifySdk/models/campaigns_vouchers_create_in_bulk_response_body' +require 'VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body_redemption' require 'VoucherifySdk/models/campaigns_vouchers_create_request_body' +require 'VoucherifySdk/models/campaigns_vouchers_create_request_body_redemption' require 'VoucherifySdk/models/campaigns_vouchers_create_response_body' +require 'VoucherifySdk/models/campaigns_vouchers_create_response_body_gift' +require 'VoucherifySdk/models/campaigns_vouchers_create_response_body_loyalty_card' +require 'VoucherifySdk/models/campaigns_vouchers_create_response_body_publish' +require 'VoucherifySdk/models/campaigns_vouchers_create_response_body_redemption' require 'VoucherifySdk/models/categories_create_request_body' require 'VoucherifySdk/models/categories_create_response_body' require 'VoucherifySdk/models/categories_get_response_body' @@ -78,265 +73,295 @@ require 'VoucherifySdk/models/client_events_create_request_body_loyalty' require 'VoucherifySdk/models/client_events_create_request_body_referral' require 'VoucherifySdk/models/client_events_create_response_body' +require 'VoucherifySdk/models/client_promotions_tiers_list_response_body' require 'VoucherifySdk/models/client_qualifications_check_eligibility_request_body' require 'VoucherifySdk/models/client_qualifications_check_eligibility_response_body' require 'VoucherifySdk/models/client_redemptions_redeem_request_body' -require 'VoucherifySdk/models/client_redemptions_redeem_request_body_all_of_options' +require 'VoucherifySdk/models/client_redemptions_redeem_request_body_options' +require 'VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item' +require 'VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_gift' +require 'VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_reward' require 'VoucherifySdk/models/client_redemptions_redeem_response_body' require 'VoucherifySdk/models/client_validations_validate_request_body' -require 'VoucherifySdk/models/client_validations_validate_request_body_all_of_options' +require 'VoucherifySdk/models/client_validations_validate_request_body_options' +require 'VoucherifySdk/models/client_validations_validate_request_body_redeemables_item' +require 'VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_gift' +require 'VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_reward' require 'VoucherifySdk/models/client_validations_validate_response_body' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_details' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount_product' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_gift' +require 'VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card' require 'VoucherifySdk/models/code_config' -require 'VoucherifySdk/models/code_config_required_length_charset_pattern' -require 'VoucherifySdk/models/create_publication_base' require 'VoucherifySdk/models/create_publication_campaign' -require 'VoucherifySdk/models/create_publication_with_campaign' -require 'VoucherifySdk/models/create_publication_with_specific_voucher' -require 'VoucherifySdk/models/custom_event' -require 'VoucherifySdk/models/custom_event_referral' require 'VoucherifySdk/models/customer' require 'VoucherifySdk/models/customer_activity' -require 'VoucherifySdk/models/customer_activity_data' -require 'VoucherifySdk/models/customer_base' -require 'VoucherifySdk/models/customer_base_address' +require 'VoucherifySdk/models/customer_address' require 'VoucherifySdk/models/customer_id' require 'VoucherifySdk/models/customer_loyalty' -require 'VoucherifySdk/models/customer_loyalty_campaigns_value' +require 'VoucherifySdk/models/customer_loyalty_campaigns_entry' +require 'VoucherifySdk/models/customer_redeemable' +require 'VoucherifySdk/models/customer_redeemable_redeemable' require 'VoucherifySdk/models/customer_referrals' require 'VoucherifySdk/models/customer_referrals_campaigns_item' -require 'VoucherifySdk/models/customer_response_data_assets' -require 'VoucherifySdk/models/customer_segments_list' require 'VoucherifySdk/models/customer_summary' require 'VoucherifySdk/models/customer_summary_orders' require 'VoucherifySdk/models/customer_summary_redemptions' require 'VoucherifySdk/models/customer_summary_redemptions_gift' require 'VoucherifySdk/models/customer_summary_redemptions_loyalty_card' require 'VoucherifySdk/models/customer_with_summary_loyalty_referrals' +require 'VoucherifySdk/models/customer_with_summary_loyalty_referrals_address' +require 'VoucherifySdk/models/customer_with_summary_loyalty_referrals_assets' require 'VoucherifySdk/models/customers_activities_list_response_body' +require 'VoucherifySdk/models/customers_activity_list_response_body' require 'VoucherifySdk/models/customers_create_request_body' +require 'VoucherifySdk/models/customers_create_request_body_address' require 'VoucherifySdk/models/customers_create_response_body' +require 'VoucherifySdk/models/customers_create_response_body_address' +require 'VoucherifySdk/models/customers_create_response_body_assets' require 'VoucherifySdk/models/customers_get_response_body' +require 'VoucherifySdk/models/customers_get_response_body_address' +require 'VoucherifySdk/models/customers_get_response_body_assets' require 'VoucherifySdk/models/customers_import_csv_create_response_body' require 'VoucherifySdk/models/customers_list_response_body' require 'VoucherifySdk/models/customers_metadata_update_in_bulk_request_body' require 'VoucherifySdk/models/customers_metadata_update_in_bulk_response_body' require 'VoucherifySdk/models/customers_permanent_deletion_create_response_body' require 'VoucherifySdk/models/customers_permanent_deletion_create_response_body_data_json' +require 'VoucherifySdk/models/customers_redeemables_list_response_body' require 'VoucherifySdk/models/customers_segments_list_response_body' require 'VoucherifySdk/models/customers_update_in_bulk_request_body' +require 'VoucherifySdk/models/customers_update_in_bulk_request_body_address' require 'VoucherifySdk/models/customers_update_in_bulk_response_body' require 'VoucherifySdk/models/customers_update_request_body' +require 'VoucherifySdk/models/customers_update_request_body_address' require 'VoucherifySdk/models/customers_update_response_body' +require 'VoucherifySdk/models/customers_update_response_body_address' +require 'VoucherifySdk/models/customers_update_response_body_assets' require 'VoucherifySdk/models/discount' -require 'VoucherifySdk/models/discount_amount' -require 'VoucherifySdk/models/discount_amount_vouchers_effect_types' -require 'VoucherifySdk/models/discount_coupons_campaign_voucher' -require 'VoucherifySdk/models/discount_fixed' -require 'VoucherifySdk/models/discount_fixed_vouchers_effect_types' -require 'VoucherifySdk/models/discount_percent' -require 'VoucherifySdk/models/discount_percent_vouchers_effect_types' -require 'VoucherifySdk/models/discount_unit' -require 'VoucherifySdk/models/discount_unit_multiple' require 'VoucherifySdk/models/discount_unit_multiple_one_unit' -require 'VoucherifySdk/models/discount_unit_vouchers_effect_types' require 'VoucherifySdk/models/earning_rule' -require 'VoucherifySdk/models/earning_rule_base' -require 'VoucherifySdk/models/earning_rule_base_custom_event' -require 'VoucherifySdk/models/earning_rule_base_loyalty' -require 'VoucherifySdk/models/earning_rule_base_segment' -require 'VoucherifySdk/models/earning_rule_base_source' -require 'VoucherifySdk/models/earning_rule_base_validity_timeframe' -require 'VoucherifySdk/models/earning_rule_event' -require 'VoucherifySdk/models/earning_rule_fixed' -require 'VoucherifySdk/models/earning_rule_proportional' -require 'VoucherifySdk/models/earning_rule_proportional_custom_event' -require 'VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event' -require 'VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event_metadata' -require 'VoucherifySdk/models/earning_rule_proportional_customer_metadata' -require 'VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer' -require 'VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer_metadata' -require 'VoucherifySdk/models/earning_rule_proportional_order' -require 'VoucherifySdk/models/earning_rule_proportional_order_amount' -require 'VoucherifySdk/models/earning_rule_proportional_order_amount_order' -require 'VoucherifySdk/models/earning_rule_proportional_order_amount_order_amount' -require 'VoucherifySdk/models/earning_rule_proportional_order_items' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_amount' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items_amount' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_quantity' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_quantity_order_items' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount' -require 'VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount_order_items' -require 'VoucherifySdk/models/earning_rule_proportional_order_metadata' -require 'VoucherifySdk/models/earning_rule_proportional_order_metadata_order' -require 'VoucherifySdk/models/earning_rule_proportional_order_metadata_order_metadata' -require 'VoucherifySdk/models/earning_rule_proportional_order_total_amount' -require 'VoucherifySdk/models/earning_rule_proportional_order_total_amount_order' +require 'VoucherifySdk/models/earning_rule_custom_event' +require 'VoucherifySdk/models/earning_rule_loyalty' +require 'VoucherifySdk/models/earning_rule_loyalty_custom_event' +require 'VoucherifySdk/models/earning_rule_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/earning_rule_loyalty_customer' +require 'VoucherifySdk/models/earning_rule_loyalty_customer_metadata' +require 'VoucherifySdk/models/earning_rule_loyalty_order' +require 'VoucherifySdk/models/earning_rule_loyalty_order_amount' +require 'VoucherifySdk/models/earning_rule_loyalty_order_items' +require 'VoucherifySdk/models/earning_rule_loyalty_order_items_amount' +require 'VoucherifySdk/models/earning_rule_loyalty_order_items_quantity' +require 'VoucherifySdk/models/earning_rule_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/earning_rule_loyalty_order_metadata' +require 'VoucherifySdk/models/earning_rule_loyalty_order_total_amount' +require 'VoucherifySdk/models/earning_rule_loyalty_tier' +require 'VoucherifySdk/models/earning_rule_segment' +require 'VoucherifySdk/models/earning_rule_source' require 'VoucherifySdk/models/error' -require 'VoucherifySdk/models/event_customer_active_campaign_failed' -require 'VoucherifySdk/models/event_customer_active_campaign_recovered' -require 'VoucherifySdk/models/event_customer_active_campaign_sent' -require 'VoucherifySdk/models/event_customer_batch_failed' -require 'VoucherifySdk/models/event_customer_batch_recovered' -require 'VoucherifySdk/models/event_customer_batch_sent' -require 'VoucherifySdk/models/event_customer_braze_failed' -require 'VoucherifySdk/models/event_customer_braze_recovered' -require 'VoucherifySdk/models/event_customer_braze_sent' -require 'VoucherifySdk/models/event_customer_confirmed' -require 'VoucherifySdk/models/event_customer_confirmed_unconfirmed_customer' -require 'VoucherifySdk/models/event_customer_consents' -require 'VoucherifySdk/models/event_customer_consents_given' -require 'VoucherifySdk/models/event_customer_consents_revoked' -require 'VoucherifySdk/models/event_customer_created' -require 'VoucherifySdk/models/event_customer_custom_event' -require 'VoucherifySdk/models/event_customer_deleted' -require 'VoucherifySdk/models/event_customer_email_failed' -require 'VoucherifySdk/models/event_customer_email_recovered' -require 'VoucherifySdk/models/event_customer_email_sent' -require 'VoucherifySdk/models/event_customer_failed' -require 'VoucherifySdk/models/event_customer_gift_voucher_balance_added' -require 'VoucherifySdk/models/event_customer_intercom_failed' -require 'VoucherifySdk/models/event_customer_intercom_recovered' -require 'VoucherifySdk/models/event_customer_intercom_sent' -require 'VoucherifySdk/models/event_customer_klaviyo_failed' -require 'VoucherifySdk/models/event_customer_klaviyo_recovered' -require 'VoucherifySdk/models/event_customer_klaviyo_sent' -require 'VoucherifySdk/models/event_customer_loyalty_card_points_added' -require 'VoucherifySdk/models/event_customer_loyalty_card_points_transferred' -require 'VoucherifySdk/models/event_customer_loyalty_tier_base' -require 'VoucherifySdk/models/event_customer_loyalty_tier_downgraded' -require 'VoucherifySdk/models/event_customer_loyalty_tier_expiration_changed' -require 'VoucherifySdk/models/event_customer_loyalty_tier_joined' -require 'VoucherifySdk/models/event_customer_loyalty_tier_left' -require 'VoucherifySdk/models/event_customer_loyalty_tier_prolonged' -require 'VoucherifySdk/models/event_customer_loyalty_tier_upgraded' -require 'VoucherifySdk/models/event_customer_loyalty_updated' -require 'VoucherifySdk/models/event_customer_mailchimp_failed' -require 'VoucherifySdk/models/event_customer_mailchimp_recovered' -require 'VoucherifySdk/models/event_customer_mailchimp_sent' -require 'VoucherifySdk/models/event_customer_order' -require 'VoucherifySdk/models/event_customer_order_canceled' -require 'VoucherifySdk/models/event_customer_order_created' -require 'VoucherifySdk/models/event_customer_order_fulfilled' -require 'VoucherifySdk/models/event_customer_order_paid' -require 'VoucherifySdk/models/event_customer_order_processing' -require 'VoucherifySdk/models/event_customer_order_updated' -require 'VoucherifySdk/models/event_customer_publication_failed' -require 'VoucherifySdk/models/event_customer_publication_succeeded' -require 'VoucherifySdk/models/event_customer_recovered' -require 'VoucherifySdk/models/event_customer_redemption' -require 'VoucherifySdk/models/event_customer_redemption_failed' -require 'VoucherifySdk/models/event_customer_redemption_rollback_failed' -require 'VoucherifySdk/models/event_customer_redemption_rollback_succeeded' -require 'VoucherifySdk/models/event_customer_redemption_succeeded' -require 'VoucherifySdk/models/event_customer_referred' -require 'VoucherifySdk/models/event_customer_reward_redemptions' -require 'VoucherifySdk/models/event_customer_reward_redemptions_completed' -require 'VoucherifySdk/models/event_customer_reward_redemptions_created' -require 'VoucherifySdk/models/event_customer_reward_redemptions_pending' -require 'VoucherifySdk/models/event_customer_reward_redemptions_rolled_back' -require 'VoucherifySdk/models/event_customer_rewarded' -require 'VoucherifySdk/models/event_customer_rewarded_loyalty_points' -require 'VoucherifySdk/models/event_customer_segment_entered' -require 'VoucherifySdk/models/event_customer_segment_left' -require 'VoucherifySdk/models/event_customer_sent' -require 'VoucherifySdk/models/event_customer_shopify_failed' -require 'VoucherifySdk/models/event_customer_shopify_recovered' -require 'VoucherifySdk/models/event_customer_shopify_sent' -require 'VoucherifySdk/models/event_customer_sms_failed' -require 'VoucherifySdk/models/event_customer_sms_recovered' -require 'VoucherifySdk/models/event_customer_sms_sent' -require 'VoucherifySdk/models/event_customer_updated' -require 'VoucherifySdk/models/event_customer_validation_failed' -require 'VoucherifySdk/models/event_customer_validation_succeeded' -require 'VoucherifySdk/models/event_customer_voucher_deleted' -require 'VoucherifySdk/models/event_customer_vouchers_loyalty_points_expired' require 'VoucherifySdk/models/events_create_request_body' +require 'VoucherifySdk/models/events_create_request_body_loyalty' +require 'VoucherifySdk/models/events_create_request_body_referral' require 'VoucherifySdk/models/events_create_response_body' require 'VoucherifySdk/models/export' -require 'VoucherifySdk/models/export_base' -require 'VoucherifySdk/models/export_base_result' -require 'VoucherifySdk/models/export_customer' -require 'VoucherifySdk/models/export_customer_base' -require 'VoucherifySdk/models/export_customer_base_parameters' -require 'VoucherifySdk/models/export_customer_fields' -require 'VoucherifySdk/models/export_customer_order' -require 'VoucherifySdk/models/export_customer_scheduled' -require 'VoucherifySdk/models/export_order' -require 'VoucherifySdk/models/export_order_base' require 'VoucherifySdk/models/export_order_fields' require 'VoucherifySdk/models/export_order_order' -require 'VoucherifySdk/models/export_order_scheduled' -require 'VoucherifySdk/models/export_points_expiration' -require 'VoucherifySdk/models/export_points_expiration_base' -require 'VoucherifySdk/models/export_points_expiration_base_parameters' -require 'VoucherifySdk/models/export_points_expiration_fields' -require 'VoucherifySdk/models/export_points_expiration_filters' -require 'VoucherifySdk/models/export_points_expiration_order' -require 'VoucherifySdk/models/export_points_expiration_scheduled' -require 'VoucherifySdk/models/export_publication' -require 'VoucherifySdk/models/export_publication_base' -require 'VoucherifySdk/models/export_publication_base_parameters' -require 'VoucherifySdk/models/export_publication_fields' -require 'VoucherifySdk/models/export_publication_order' -require 'VoucherifySdk/models/export_publication_scheduled' -require 'VoucherifySdk/models/export_redemption' -require 'VoucherifySdk/models/export_redemption_base' -require 'VoucherifySdk/models/export_redemption_base_parameters' -require 'VoucherifySdk/models/export_redemption_fields' -require 'VoucherifySdk/models/export_redemption_order' -require 'VoucherifySdk/models/export_redemption_scheduled' -require 'VoucherifySdk/models/export_scheduled_base' -require 'VoucherifySdk/models/export_voucher' -require 'VoucherifySdk/models/export_voucher_base' -require 'VoucherifySdk/models/export_voucher_base_parameters' -require 'VoucherifySdk/models/export_voucher_fields' -require 'VoucherifySdk/models/export_voucher_order' -require 'VoucherifySdk/models/export_voucher_scheduled' -require 'VoucherifySdk/models/export_voucher_transactions' -require 'VoucherifySdk/models/export_voucher_transactions_base' +require 'VoucherifySdk/models/export_parameters' +require 'VoucherifySdk/models/export_parameters_filters' +require 'VoucherifySdk/models/export_result' require 'VoucherifySdk/models/export_voucher_transactions_fields' require 'VoucherifySdk/models/export_voucher_transactions_filters' require 'VoucherifySdk/models/export_voucher_transactions_order' -require 'VoucherifySdk/models/export_voucher_transactions_scheduled' require 'VoucherifySdk/models/exports_create_request_body' +require 'VoucherifySdk/models/exports_create_request_body_parameters' +require 'VoucherifySdk/models/exports_create_request_body_parameters_filters' require 'VoucherifySdk/models/exports_create_response_body' +require 'VoucherifySdk/models/exports_create_response_body_parameters' +require 'VoucherifySdk/models/exports_create_response_body_parameters_filters' require 'VoucherifySdk/models/exports_get_response_body' +require 'VoucherifySdk/models/exports_get_response_body_parameters' +require 'VoucherifySdk/models/exports_get_response_body_parameters_filters' +require 'VoucherifySdk/models/exports_get_response_body_result' require 'VoucherifySdk/models/exports_list_response_body' require 'VoucherifySdk/models/field_conditions' require 'VoucherifySdk/models/filter_conditions_string' require 'VoucherifySdk/models/filters_condition' require 'VoucherifySdk/models/gift' -require 'VoucherifySdk/models/gift_campaign_voucher' -require 'VoucherifySdk/models/giveaway_campaign_voucher' require 'VoucherifySdk/models/inapplicable_to' require 'VoucherifySdk/models/inapplicable_to_result_list' require 'VoucherifySdk/models/junction' -require 'VoucherifySdk/models/list_publications_item_base' -require 'VoucherifySdk/models/list_publications_item_invalid' -require 'VoucherifySdk/models/list_publications_item_valid_multiple_vouchers' -require 'VoucherifySdk/models/list_publications_item_valid_single_voucher' require 'VoucherifySdk/models/list_publications_item_voucher' +require 'VoucherifySdk/models/loyalties_create_campaign_request_body' +require 'VoucherifySdk/models/loyalties_create_campaign_response_body' require 'VoucherifySdk/models/loyalties_delete_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_tier' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_segment' +require 'VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_source' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_tier' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_segment' +require 'VoucherifySdk/models/loyalties_earning_rules_create_response_body_source' require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_tier' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_segment' +require 'VoucherifySdk/models/loyalties_earning_rules_disable_response_body_source' require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_tier' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_segment' +require 'VoucherifySdk/models/loyalties_earning_rules_enable_response_body_source' require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_tier' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_segment' +require 'VoucherifySdk/models/loyalties_earning_rules_get_response_body_source' +require 'VoucherifySdk/models/loyalties_earning_rules_list_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_request_body_source' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_tier' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_segment' +require 'VoucherifySdk/models/loyalties_earning_rules_update_response_body_source' +require 'VoucherifySdk/models/loyalties_get_campaign_response_body' +require 'VoucherifySdk/models/loyalties_list_campaigns_response_body' +require 'VoucherifySdk/models/loyalties_list_members_response_body' require 'VoucherifySdk/models/loyalties_loyalty_tier_reward' +require 'VoucherifySdk/models/loyalties_member_activity_list_response_body' require 'VoucherifySdk/models/loyalties_members_balance_update_request_body' require 'VoucherifySdk/models/loyalties_members_balance_update_response_body' require 'VoucherifySdk/models/loyalties_members_balance_update_response_body_related_object' +require 'VoucherifySdk/models/loyalties_members_create_request_body' +require 'VoucherifySdk/models/loyalties_members_create_response_body' +require 'VoucherifySdk/models/loyalties_members_create_response_body_loyalty_card' +require 'VoucherifySdk/models/loyalties_members_create_response_body_publish' +require 'VoucherifySdk/models/loyalties_members_create_response_body_redemption' +require 'VoucherifySdk/models/loyalties_members_get_response_body' +require 'VoucherifySdk/models/loyalties_members_get_response_body_loyalty_card' +require 'VoucherifySdk/models/loyalties_members_get_response_body_publish' +require 'VoucherifySdk/models/loyalties_members_get_response_body_redemption' require 'VoucherifySdk/models/loyalties_members_points_expiration_list_response_body' require 'VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item' require 'VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item_bucket' require 'VoucherifySdk/models/loyalties_members_redemption_redeem_request_body' require 'VoucherifySdk/models/loyalties_members_redemption_redeem_request_body_reward' require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_channel' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_gift' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_loyalty_card' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_gift' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_publish' +require 'VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_redemption' require 'VoucherifySdk/models/loyalties_members_rewards_list_response_body' require 'VoucherifySdk/models/loyalties_members_rewards_list_response_body_data_item' require 'VoucherifySdk/models/loyalties_members_tiers_list_response_body' require 'VoucherifySdk/models/loyalties_members_transactions_export_create_request_body' require 'VoucherifySdk/models/loyalties_members_transactions_export_create_request_body_parameters' require 'VoucherifySdk/models/loyalties_members_transactions_export_create_response_body' +require 'VoucherifySdk/models/loyalties_members_transactions_export_create_response_body_parameters' require 'VoucherifySdk/models/loyalties_members_transactions_list_response_body' require 'VoucherifySdk/models/loyalties_members_transfers_create_response_body' require 'VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets' @@ -345,58 +370,130 @@ require 'VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card' require 'VoucherifySdk/models/loyalties_members_transfers_create_response_body_publish' require 'VoucherifySdk/models/loyalties_members_transfers_create_response_body_redemption' -require 'VoucherifySdk/models/loyalties_members_transfers_create_response_body_validity_timeframe' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id' +require 'VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions' require 'VoucherifySdk/models/loyalties_reward_assignments_get_response_body' +require 'VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters' +require 'VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters_loyalty' +require 'VoucherifySdk/models/loyalties_reward_assignments_list_response_body' require 'VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body' +require 'VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body_attributes' +require 'VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body' +require 'VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters' +require 'VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty' +require 'VoucherifySdk/models/loyalties_rewards_create_assignment_response_body' +require 'VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters' +require 'VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty' require 'VoucherifySdk/models/loyalties_rewards_get_response_body' +require 'VoucherifySdk/models/loyalties_rewards_get_response_body_parameters' +require 'VoucherifySdk/models/loyalties_rewards_get_response_body_parameters_loyalty' +require 'VoucherifySdk/models/loyalties_rewards_list_assignments_response_body' +require 'VoucherifySdk/models/loyalties_rewards_update_assignment_request_body' +require 'VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters' +require 'VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty' +require 'VoucherifySdk/models/loyalties_rewards_update_assignment_response_body' +require 'VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters' +require 'VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty' require 'VoucherifySdk/models/loyalties_tiers_create_in_bulk_request_body_item' require 'VoucherifySdk/models/loyalties_tiers_earning_rules_list_response_body' require 'VoucherifySdk/models/loyalties_tiers_get_response_body' +require 'VoucherifySdk/models/loyalties_tiers_get_response_body_config' +require 'VoucherifySdk/models/loyalties_tiers_get_response_body_config_points' +require 'VoucherifySdk/models/loyalties_tiers_get_response_body_points' require 'VoucherifySdk/models/loyalties_tiers_list_response_body' require 'VoucherifySdk/models/loyalties_tiers_rewards_list_response_body' require 'VoucherifySdk/models/loyalties_transfer_points' +require 'VoucherifySdk/models/loyalties_update_campaign_request_body' +require 'VoucherifySdk/models/loyalties_update_campaign_request_body_options' +require 'VoucherifySdk/models/loyalties_update_campaign_response_body' +require 'VoucherifySdk/models/loyalty_campaign' +require 'VoucherifySdk/models/loyalty_campaign_voucher' +require 'VoucherifySdk/models/loyalty_campaign_voucher_redemption' require 'VoucherifySdk/models/loyalty_card_transaction' +require 'VoucherifySdk/models/loyalty_card_transaction_details' +require 'VoucherifySdk/models/loyalty_card_transaction_details_balance' +require 'VoucherifySdk/models/loyalty_card_transaction_details_balance_related_object' +require 'VoucherifySdk/models/loyalty_card_transaction_details_custom_event' +require 'VoucherifySdk/models/loyalty_card_transaction_details_earning_rule' +require 'VoucherifySdk/models/loyalty_card_transaction_details_earning_rule_source' +require 'VoucherifySdk/models/loyalty_card_transaction_details_event' +require 'VoucherifySdk/models/loyalty_card_transaction_details_event_schema' +require 'VoucherifySdk/models/loyalty_card_transaction_details_loyalty_tier' +require 'VoucherifySdk/models/loyalty_card_transaction_details_order' +require 'VoucherifySdk/models/loyalty_card_transaction_details_redemption' +require 'VoucherifySdk/models/loyalty_card_transaction_details_reward' +require 'VoucherifySdk/models/loyalty_card_transaction_details_rollback' +require 'VoucherifySdk/models/loyalty_card_transaction_details_segment' require 'VoucherifySdk/models/loyalty_card_transactions_type' +require 'VoucherifySdk/models/loyalty_member' +require 'VoucherifySdk/models/loyalty_member_loyalty_card' +require 'VoucherifySdk/models/loyalty_member_publish' +require 'VoucherifySdk/models/loyalty_member_redemption' require 'VoucherifySdk/models/loyalty_tier' -require 'VoucherifySdk/models/loyalty_tier_all_of_config' -require 'VoucherifySdk/models/loyalty_tier_all_of_config_points' require 'VoucherifySdk/models/loyalty_tier_base' require 'VoucherifySdk/models/loyalty_tier_base_points' +require 'VoucherifySdk/models/loyalty_tier_config' +require 'VoucherifySdk/models/loyalty_tier_config_points' require 'VoucherifySdk/models/loyalty_tier_expiration' +require 'VoucherifySdk/models/loyalty_tier_points' require 'VoucherifySdk/models/loyalty_tiers_expiration_all' require 'VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date' require 'VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date_rounding' require 'VoucherifySdk/models/loyalty_tiers_expiration_all_start_date' require 'VoucherifySdk/models/lucky_draw' -require 'VoucherifySdk/models/mapping_fixed' -require 'VoucherifySdk/models/mapping_multiply' require 'VoucherifySdk/models/mapping_points' +require 'VoucherifySdk/models/member_activity' require 'VoucherifySdk/models/order' -require 'VoucherifySdk/models/order_base' require 'VoucherifySdk/models/order_calculated' -require 'VoucherifySdk/models/order_calculated_base' -require 'VoucherifySdk/models/order_calculated_customer' -require 'VoucherifySdk/models/order_calculated_no_customer_data' -require 'VoucherifySdk/models/order_calculated_referrer' +require 'VoucherifySdk/models/order_calculated_item' +require 'VoucherifySdk/models/order_calculated_item_product' +require 'VoucherifySdk/models/order_calculated_item_sku' require 'VoucherifySdk/models/order_item' -require 'VoucherifySdk/models/order_item_calculated' require 'VoucherifySdk/models/order_item_product' require 'VoucherifySdk/models/order_item_sku' -require 'VoucherifySdk/models/order_redemptions' +require 'VoucherifySdk/models/order_redemptions_entry' require 'VoucherifySdk/models/orders_create_request_body' require 'VoucherifySdk/models/orders_create_response_body' require 'VoucherifySdk/models/orders_export_create_request_body' require 'VoucherifySdk/models/orders_export_create_request_body_parameters' require 'VoucherifySdk/models/orders_export_create_response_body' +require 'VoucherifySdk/models/orders_export_create_response_body_parameters' require 'VoucherifySdk/models/orders_get_response_body' require 'VoucherifySdk/models/orders_import_create_request_body_item' require 'VoucherifySdk/models/orders_import_create_response_body' require 'VoucherifySdk/models/orders_list_response_body' require 'VoucherifySdk/models/orders_update_request_body' require 'VoucherifySdk/models/orders_update_response_body' +require 'VoucherifySdk/models/parameter_activity_category' require 'VoucherifySdk/models/parameter_campaign_type' require 'VoucherifySdk/models/parameter_created_before_after' require 'VoucherifySdk/models/parameter_expand_list_campaigns' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_id' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type_conditions' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at_conditions' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role_conditions' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_id' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_id' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type' +require 'VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type_conditions' require 'VoucherifySdk/models/parameter_filters_list_redemptions' require 'VoucherifySdk/models/parameter_filters_list_redemptions_campaign_name' require 'VoucherifySdk/models/parameter_filters_list_redemptions_customer_id' @@ -409,35 +506,42 @@ require 'VoucherifySdk/models/parameter_filters_list_redemptions_user_login' require 'VoucherifySdk/models/parameter_filters_list_redemptions_voucher_code' require 'VoucherifySdk/models/parameter_order' +require 'VoucherifySdk/models/parameter_order_created_at' require 'VoucherifySdk/models/parameter_order_list_all_promotion_stacks' require 'VoucherifySdk/models/parameter_order_list_campaigns' require 'VoucherifySdk/models/parameter_order_list_customers' +require 'VoucherifySdk/models/parameter_order_list_earning_rules' require 'VoucherifySdk/models/parameter_order_list_exports' require 'VoucherifySdk/models/parameter_order_list_loyalty_tiers' require 'VoucherifySdk/models/parameter_order_list_orders' +require 'VoucherifySdk/models/parameter_order_list_promotion_tiers' +require 'VoucherifySdk/models/parameter_order_list_promotion_tiers_client_side' require 'VoucherifySdk/models/parameter_order_list_publications' +require 'VoucherifySdk/models/parameter_order_list_redeemables' require 'VoucherifySdk/models/parameter_order_list_redemptions' require 'VoucherifySdk/models/parameter_order_list_validation_rule_assignments' require 'VoucherifySdk/models/parameter_order_list_validation_rules' +require 'VoucherifySdk/models/parameter_order_vouchers' require 'VoucherifySdk/models/parameter_result_list_publications' require 'VoucherifySdk/models/parameter_updated_before_after' require 'VoucherifySdk/models/parameter_voucher_type_list_publications' require 'VoucherifySdk/models/points_expiration_types' require 'VoucherifySdk/models/product' -require 'VoucherifySdk/models/product_collections_create_dynamic_request_body' -require 'VoucherifySdk/models/product_collections_create_dynamic_request_body_filter' -require 'VoucherifySdk/models/product_collections_create_dynamic_request_body_products_item' require 'VoucherifySdk/models/product_collections_create_request_body' +require 'VoucherifySdk/models/product_collections_create_request_body_filter' +require 'VoucherifySdk/models/product_collections_create_request_body_products_item' require 'VoucherifySdk/models/product_collections_create_response_body' -require 'VoucherifySdk/models/product_collections_create_static_request_body' +require 'VoucherifySdk/models/product_collections_create_response_body_filter' +require 'VoucherifySdk/models/product_collections_create_response_body_products_item' require 'VoucherifySdk/models/product_collections_get_response_body' +require 'VoucherifySdk/models/product_collections_get_response_body_filter' +require 'VoucherifySdk/models/product_collections_get_response_body_products_item' require 'VoucherifySdk/models/product_collections_item' +require 'VoucherifySdk/models/product_collections_item_filter' require 'VoucherifySdk/models/product_collections_item_products_item' -require 'VoucherifySdk/models/product_collections_list' require 'VoucherifySdk/models/product_collections_list_response_body' -require 'VoucherifySdk/models/product_collections_products_list' -require 'VoucherifySdk/models/product_collections_products_list_products_item' require 'VoucherifySdk/models/product_collections_products_list_response_body' +require 'VoucherifySdk/models/product_collections_products_list_response_body_data_item' require 'VoucherifySdk/models/product_without_skus' require 'VoucherifySdk/models/products_create_request_body' require 'VoucherifySdk/models/products_create_response_body' @@ -458,186 +562,317 @@ require 'VoucherifySdk/models/promotion_stack' require 'VoucherifySdk/models/promotion_stack_base' require 'VoucherifySdk/models/promotion_stack_base_tiers' +require 'VoucherifySdk/models/promotion_stack_tiers' require 'VoucherifySdk/models/promotion_tier' require 'VoucherifySdk/models/promotion_tier_action' require 'VoucherifySdk/models/promotion_tier_campaign' -require 'VoucherifySdk/models/promotion_tier_campaign_validity_timeframe' require 'VoucherifySdk/models/promotion_tier_create_params' +require 'VoucherifySdk/models/promotion_tier_create_params_action' require 'VoucherifySdk/models/promotion_tier_summary' require 'VoucherifySdk/models/promotion_tier_summary_orders' require 'VoucherifySdk/models/promotion_tier_summary_redemptions' -require 'VoucherifySdk/models/promotion_tier_validity_timeframe' require 'VoucherifySdk/models/promotion_tiers_list' require 'VoucherifySdk/models/promotions_stacks_create_request_body' +require 'VoucherifySdk/models/promotions_stacks_create_request_body_tiers' require 'VoucherifySdk/models/promotions_stacks_create_response_body' +require 'VoucherifySdk/models/promotions_stacks_create_response_body_tiers' require 'VoucherifySdk/models/promotions_stacks_get_response_body' +require 'VoucherifySdk/models/promotions_stacks_get_response_body_tiers' require 'VoucherifySdk/models/promotions_stacks_list_response_body' require 'VoucherifySdk/models/promotions_stacks_update_request_body' require 'VoucherifySdk/models/promotions_stacks_update_request_body_tiers' require 'VoucherifySdk/models/promotions_stacks_update_response_body' +require 'VoucherifySdk/models/promotions_stacks_update_response_body_tiers' +require 'VoucherifySdk/models/promotions_tiers_create_request_body' +require 'VoucherifySdk/models/promotions_tiers_create_request_body_action' +require 'VoucherifySdk/models/promotions_tiers_create_response_body' +require 'VoucherifySdk/models/promotions_tiers_create_response_body_action' +require 'VoucherifySdk/models/promotions_tiers_create_response_body_campaign' +require 'VoucherifySdk/models/promotions_tiers_create_response_body_summary' +require 'VoucherifySdk/models/promotions_tiers_create_response_body_summary_orders' +require 'VoucherifySdk/models/promotions_tiers_create_response_body_summary_redemptions' require 'VoucherifySdk/models/promotions_tiers_disable_response_body' +require 'VoucherifySdk/models/promotions_tiers_disable_response_body_action' +require 'VoucherifySdk/models/promotions_tiers_disable_response_body_campaign' +require 'VoucherifySdk/models/promotions_tiers_disable_response_body_summary' +require 'VoucherifySdk/models/promotions_tiers_disable_response_body_summary_orders' +require 'VoucherifySdk/models/promotions_tiers_disable_response_body_summary_redemptions' require 'VoucherifySdk/models/promotions_tiers_enable_response_body' +require 'VoucherifySdk/models/promotions_tiers_enable_response_body_action' +require 'VoucherifySdk/models/promotions_tiers_enable_response_body_campaign' +require 'VoucherifySdk/models/promotions_tiers_enable_response_body_summary' +require 'VoucherifySdk/models/promotions_tiers_enable_response_body_summary_orders' +require 'VoucherifySdk/models/promotions_tiers_enable_response_body_summary_redemptions' require 'VoucherifySdk/models/promotions_tiers_get_response_body' +require 'VoucherifySdk/models/promotions_tiers_get_response_body_action' +require 'VoucherifySdk/models/promotions_tiers_get_response_body_campaign' +require 'VoucherifySdk/models/promotions_tiers_get_response_body_summary' +require 'VoucherifySdk/models/promotions_tiers_get_response_body_summary_orders' +require 'VoucherifySdk/models/promotions_tiers_get_response_body_summary_redemptions' require 'VoucherifySdk/models/promotions_tiers_list_response_body' -require 'VoucherifySdk/models/properties_for_loyalty_campaign_options' -require 'VoucherifySdk/models/publications_create_base_response_body' +require 'VoucherifySdk/models/promotions_tiers_update_request_body' +require 'VoucherifySdk/models/promotions_tiers_update_request_body_action' +require 'VoucherifySdk/models/promotions_tiers_update_response_body' +require 'VoucherifySdk/models/promotions_tiers_update_response_body_action' +require 'VoucherifySdk/models/promotions_tiers_update_response_body_campaign' +require 'VoucherifySdk/models/promotions_tiers_update_response_body_summary' +require 'VoucherifySdk/models/promotions_tiers_update_response_body_summary_orders' +require 'VoucherifySdk/models/promotions_tiers_update_response_body_summary_redemptions' require 'VoucherifySdk/models/publications_create_request_body' +require 'VoucherifySdk/models/publications_create_request_body_customer' +require 'VoucherifySdk/models/publications_create_request_body_customer_address' require 'VoucherifySdk/models/publications_create_response_body' -require 'VoucherifySdk/models/publications_create_voucher_response_body' -require 'VoucherifySdk/models/publications_create_vouchers_response_body' require 'VoucherifySdk/models/publications_list_response_body' require 'VoucherifySdk/models/publications_list_response_body_publications_item' +require 'VoucherifySdk/models/publications_list_response_body_publications_item_metadata' require 'VoucherifySdk/models/qualifications_check_eligibility_request_body' require 'VoucherifySdk/models/qualifications_check_eligibility_response_body' require 'VoucherifySdk/models/qualifications_field_conditions' require 'VoucherifySdk/models/qualifications_filters_condition' require 'VoucherifySdk/models/qualifications_option' require 'VoucherifySdk/models/qualifications_option_filters' +require 'VoucherifySdk/models/qualifications_option_filters_campaign_type' +require 'VoucherifySdk/models/qualifications_option_filters_campaign_type_conditions' +require 'VoucherifySdk/models/qualifications_option_filters_holder_role' +require 'VoucherifySdk/models/qualifications_option_filters_holder_role_conditions' require 'VoucherifySdk/models/qualifications_option_filters_resource_type' require 'VoucherifySdk/models/qualifications_option_filters_resource_type_conditions' require 'VoucherifySdk/models/qualifications_redeemable' require 'VoucherifySdk/models/qualifications_redeemable_base' require 'VoucherifySdk/models/qualifications_redeemables' -require 'VoucherifySdk/models/redeem_gift_card' -require 'VoucherifySdk/models/redeem_gift_card_all_of_gift' -require 'VoucherifySdk/models/redeem_loyalty_card' -require 'VoucherifySdk/models/redeem_loyalty_card_all_of_reward' -require 'VoucherifySdk/models/redeem_promotion_stack' -require 'VoucherifySdk/models/redeem_promotion_tier' -require 'VoucherifySdk/models/redeem_voucher' require 'VoucherifySdk/models/redeemable_gift' require 'VoucherifySdk/models/redeemable_loyalty_card' require 'VoucherifySdk/models/redeemable_result' -require 'VoucherifySdk/models/redeemable_result_gift_card' -require 'VoucherifySdk/models/redeemable_result_gift_card_gift' -require 'VoucherifySdk/models/redeemable_result_loyalty_card' -require 'VoucherifySdk/models/redeemable_result_loyalty_card_loyalty_card' -require 'VoucherifySdk/models/redeemable_result_promotion_stack' -require 'VoucherifySdk/models/redeemable_result_promotion_tier' -require 'VoucherifySdk/models/redeemable_result_promotion_tier_discount' -require 'VoucherifySdk/models/redeemable_result_voucher_code' +require 'VoucherifySdk/models/redeemable_voucher' +require 'VoucherifySdk/models/redeemable_voucher_gift' +require 'VoucherifySdk/models/redeemable_voucher_loyalty_card' +require 'VoucherifySdk/models/redeemable_voucher_publish' +require 'VoucherifySdk/models/redeemable_voucher_redemption' require 'VoucherifySdk/models/redemption' require 'VoucherifySdk/models/redemption_channel' +require 'VoucherifySdk/models/redemption_entry' +require 'VoucherifySdk/models/redemption_entry_channel' +require 'VoucherifySdk/models/redemption_entry_customer' +require 'VoucherifySdk/models/redemption_entry_gift' +require 'VoucherifySdk/models/redemption_entry_loyalty_card' +require 'VoucherifySdk/models/redemption_entry_order' +require 'VoucherifySdk/models/redemption_entry_order_customer' +require 'VoucherifySdk/models/redemption_entry_order_referrer' +require 'VoucherifySdk/models/redemption_entry_promotion_tier' +require 'VoucherifySdk/models/redemption_entry_promotion_tier_action' +require 'VoucherifySdk/models/redemption_entry_promotion_tier_campaign' +require 'VoucherifySdk/models/redemption_entry_promotion_tier_summary' +require 'VoucherifySdk/models/redemption_entry_promotion_tier_summary_orders' +require 'VoucherifySdk/models/redemption_entry_promotion_tier_summary_redemptions' +require 'VoucherifySdk/models/redemption_entry_related_redemptions' +require 'VoucherifySdk/models/redemption_entry_related_redemptions_redemptions_item' +require 'VoucherifySdk/models/redemption_entry_related_redemptions_rollbacks_item' +require 'VoucherifySdk/models/redemption_entry_voucher' +require 'VoucherifySdk/models/redemption_entry_voucher_gift' +require 'VoucherifySdk/models/redemption_entry_voucher_loyalty_card' +require 'VoucherifySdk/models/redemption_entry_voucher_publish' +require 'VoucherifySdk/models/redemption_entry_voucher_redemption' require 'VoucherifySdk/models/redemption_gift' -require 'VoucherifySdk/models/redemption_internal' -require 'VoucherifySdk/models/redemption_internal_related_redemptions' -require 'VoucherifySdk/models/redemption_internal_related_redemptions_item' -require 'VoucherifySdk/models/redemption_internal_related_redemptions_rollbacks_item' require 'VoucherifySdk/models/redemption_loyalty_card' require 'VoucherifySdk/models/redemption_related_redemptions' -require 'VoucherifySdk/models/redemption_related_redemptions_item' +require 'VoucherifySdk/models/redemption_related_redemptions_redemptions_item' require 'VoucherifySdk/models/redemption_related_redemptions_rollbacks_item' require 'VoucherifySdk/models/redemption_reward_result' require 'VoucherifySdk/models/redemption_reward_result_parameters' require 'VoucherifySdk/models/redemption_reward_result_parameters_campaign' require 'VoucherifySdk/models/redemption_reward_result_parameters_coin' require 'VoucherifySdk/models/redemption_reward_result_parameters_product' -require 'VoucherifySdk/models/redemption_reward_result_product' -require 'VoucherifySdk/models/redemption_reward_result_sku' -require 'VoucherifySdk/models/redemption_reward_result_voucher' require 'VoucherifySdk/models/redemption_rollback' +require 'VoucherifySdk/models/redemption_rollback_channel' +require 'VoucherifySdk/models/redemption_rollback_gift' +require 'VoucherifySdk/models/redemption_rollback_loyalty_card' require 'VoucherifySdk/models/redemption_rollback_related_redemptions' -require 'VoucherifySdk/models/redemption_rollback_related_redemptions_item' +require 'VoucherifySdk/models/redemption_rollback_related_redemptions_redemptions_item' require 'VoucherifySdk/models/redemption_rollback_related_redemptions_rollbacks_item' +require 'VoucherifySdk/models/redemption_voucher' +require 'VoucherifySdk/models/redemption_voucher_gift' +require 'VoucherifySdk/models/redemption_voucher_loyalty_card' +require 'VoucherifySdk/models/redemption_voucher_publish' +require 'VoucherifySdk/models/redemption_voucher_redemption' require 'VoucherifySdk/models/redemptions_get_response_body' +require 'VoucherifySdk/models/redemptions_get_response_body_channel' +require 'VoucherifySdk/models/redemptions_get_response_body_customer' +require 'VoucherifySdk/models/redemptions_get_response_body_gift' +require 'VoucherifySdk/models/redemptions_get_response_body_loyalty_card' +require 'VoucherifySdk/models/redemptions_get_response_body_order' +require 'VoucherifySdk/models/redemptions_get_response_body_order_customer' +require 'VoucherifySdk/models/redemptions_get_response_body_order_referrer' +require 'VoucherifySdk/models/redemptions_get_response_body_promotion_tier' +require 'VoucherifySdk/models/redemptions_get_response_body_promotion_tier_action' +require 'VoucherifySdk/models/redemptions_get_response_body_promotion_tier_campaign' +require 'VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary' +require 'VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_orders' +require 'VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_redemptions' +require 'VoucherifySdk/models/redemptions_get_response_body_related_redemptions' +require 'VoucherifySdk/models/redemptions_get_response_body_related_redemptions_redemptions_item' +require 'VoucherifySdk/models/redemptions_get_response_body_related_redemptions_rollbacks_item' +require 'VoucherifySdk/models/redemptions_get_response_body_voucher' +require 'VoucherifySdk/models/redemptions_get_response_body_voucher_gift' +require 'VoucherifySdk/models/redemptions_get_response_body_voucher_loyalty_card' +require 'VoucherifySdk/models/redemptions_get_response_body_voucher_publish' +require 'VoucherifySdk/models/redemptions_get_response_body_voucher_redemption' require 'VoucherifySdk/models/redemptions_list_response_body' require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_channel' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_customer' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_gift' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_loyalty_card' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_customer' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_referrer' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_action' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_gift' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_publish' +require 'VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_redemption' require 'VoucherifySdk/models/redemptions_redeem_request_body' +require 'VoucherifySdk/models/redemptions_redeem_request_body_options' +require 'VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item' +require 'VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_gift' +require 'VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_reward' require 'VoucherifySdk/models/redemptions_redeem_response_body' require 'VoucherifySdk/models/redemptions_rollback_create_request_body' require 'VoucherifySdk/models/redemptions_rollback_create_response_body' +require 'VoucherifySdk/models/redemptions_rollback_create_response_body_channel' +require 'VoucherifySdk/models/redemptions_rollback_create_response_body_gift' +require 'VoucherifySdk/models/redemptions_rollback_create_response_body_loyalty_card' +require 'VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions' +require 'VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item' +require 'VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item' require 'VoucherifySdk/models/redemptions_rollbacks_create_request_body' require 'VoucherifySdk/models/redemptions_rollbacks_create_response_body' -require 'VoucherifySdk/models/referral_campaign_voucher' require 'VoucherifySdk/models/referral_program' require 'VoucherifySdk/models/referral_program_custom_event' require 'VoucherifySdk/models/referral_program_referee_reward' require 'VoucherifySdk/models/referral_program_referee_reward_related_object_parent' require 'VoucherifySdk/models/referrer' +require 'VoucherifySdk/models/referrer_address' require 'VoucherifySdk/models/referrer_id' -require 'VoucherifySdk/models/referrer_with_summary_loyalty_referrals' require 'VoucherifySdk/models/resource_types' require 'VoucherifySdk/models/reward' require 'VoucherifySdk/models/reward_assignment' -require 'VoucherifySdk/models/reward_assignment_base' require 'VoucherifySdk/models/reward_assignment_parameters' -require 'VoucherifySdk/models/reward_assignment_parameters_parameters' -require 'VoucherifySdk/models/reward_assignment_parameters_parameters_loyalty' -require 'VoucherifySdk/models/reward_assignments_create_coin_reward_request_body' -require 'VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body' -require 'VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters' -require 'VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters_loyalty' +require 'VoucherifySdk/models/reward_assignment_parameters_loyalty' require 'VoucherifySdk/models/reward_attributes' require 'VoucherifySdk/models/reward_type' require 'VoucherifySdk/models/reward_type_campaign' -require 'VoucherifySdk/models/reward_type_campaign_campaign' require 'VoucherifySdk/models/reward_type_coin' -require 'VoucherifySdk/models/reward_type_coin_coin' -require 'VoucherifySdk/models/reward_type_material' -require 'VoucherifySdk/models/reward_type_material_product' +require 'VoucherifySdk/models/reward_type_product' require 'VoucherifySdk/models/rewards_assignments_create_request_body' +require 'VoucherifySdk/models/rewards_assignments_create_request_body_parameters' +require 'VoucherifySdk/models/rewards_assignments_create_request_body_parameters_loyalty' require 'VoucherifySdk/models/rewards_assignments_create_response_body' +require 'VoucherifySdk/models/rewards_assignments_create_response_body_parameters' +require 'VoucherifySdk/models/rewards_assignments_create_response_body_parameters_loyalty' require 'VoucherifySdk/models/rewards_assignments_get_response_body' +require 'VoucherifySdk/models/rewards_assignments_get_response_body_parameters' +require 'VoucherifySdk/models/rewards_assignments_get_response_body_parameters_loyalty' require 'VoucherifySdk/models/rewards_assignments_list_response_body' require 'VoucherifySdk/models/rewards_assignments_update_request_body' require 'VoucherifySdk/models/rewards_assignments_update_request_body_parameters' require 'VoucherifySdk/models/rewards_assignments_update_request_body_parameters_loyalty' require 'VoucherifySdk/models/rewards_assignments_update_response_body' -require 'VoucherifySdk/models/schema_that_contains_unique_properties_for_promotion_campaign_promotion' +require 'VoucherifySdk/models/rewards_assignments_update_response_body_parameters' +require 'VoucherifySdk/models/rewards_assignments_update_response_body_parameters_loyalty' +require 'VoucherifySdk/models/rewards_create_request_body' +require 'VoucherifySdk/models/rewards_create_request_body_attributes' +require 'VoucherifySdk/models/rewards_create_request_body_parameters' +require 'VoucherifySdk/models/rewards_create_request_body_parameters_campaign' +require 'VoucherifySdk/models/rewards_create_request_body_parameters_coin' +require 'VoucherifySdk/models/rewards_create_request_body_parameters_product' +require 'VoucherifySdk/models/rewards_create_response_body' +require 'VoucherifySdk/models/rewards_create_response_body_attributes' +require 'VoucherifySdk/models/rewards_list_response_body' +require 'VoucherifySdk/models/rewards_update_request_body' +require 'VoucherifySdk/models/rewards_update_request_body_attributes' +require 'VoucherifySdk/models/rewards_update_request_body_parameters' +require 'VoucherifySdk/models/rewards_update_request_body_parameters_campaign' +require 'VoucherifySdk/models/rewards_update_request_body_parameters_coin' +require 'VoucherifySdk/models/rewards_update_request_body_parameters_product' +require 'VoucherifySdk/models/rewards_update_response_body' +require 'VoucherifySdk/models/rewards_update_response_body_attributes' +require 'VoucherifySdk/models/segments_create_request_body' +require 'VoucherifySdk/models/segments_create_response_body' +require 'VoucherifySdk/models/segments_get_response_body' require 'VoucherifySdk/models/session' -require 'VoucherifySdk/models/simple_campaign' -require 'VoucherifySdk/models/simple_consent' require 'VoucherifySdk/models/simple_customer' require 'VoucherifySdk/models/simple_customer_required_object_type' -require 'VoucherifySdk/models/simple_order' -require 'VoucherifySdk/models/simple_order_item' -require 'VoucherifySdk/models/simple_product' +require 'VoucherifySdk/models/simple_loyalty_card' require 'VoucherifySdk/models/simple_product_discount_unit' -require 'VoucherifySdk/models/simple_promotion_tier' -require 'VoucherifySdk/models/simple_promotion_tier_campaign' -require 'VoucherifySdk/models/simple_redemption' -require 'VoucherifySdk/models/simple_redemption_reward_result' -require 'VoucherifySdk/models/simple_referral_tier' require 'VoucherifySdk/models/simple_segment' -require 'VoucherifySdk/models/simple_sku' require 'VoucherifySdk/models/simple_sku_discount_unit' require 'VoucherifySdk/models/simple_voucher' +require 'VoucherifySdk/models/simple_voucher_redemption' require 'VoucherifySdk/models/sku' -require 'VoucherifySdk/models/sku_with_product' require 'VoucherifySdk/models/skus_get_response_body' require 'VoucherifySdk/models/skus_import_csv_create_response_body' -require 'VoucherifySdk/models/skus_list' require 'VoucherifySdk/models/skus_list_for_product' -require 'VoucherifySdk/models/stackable_validate_redeem_base' -require 'VoucherifySdk/models/stackable_validate_redeem_base_redeemables_item' require 'VoucherifySdk/models/stacking_rules' -require 'VoucherifySdk/models/validation_entity' require 'VoucherifySdk/models/validation_rule' +require 'VoucherifySdk/models/validation_rule_applicable_to' require 'VoucherifySdk/models/validation_rule_assignment' require 'VoucherifySdk/models/validation_rule_assignments_list' -require 'VoucherifySdk/models/validation_rule_base' -require 'VoucherifySdk/models/validation_rule_base_applicable_to' -require 'VoucherifySdk/models/validation_rule_base_error' +require 'VoucherifySdk/models/validation_rule_error' require 'VoucherifySdk/models/validation_rules_assignments_create_request_body' require 'VoucherifySdk/models/validation_rules_assignments_create_response_body' require 'VoucherifySdk/models/validation_rules_assignments_list' require 'VoucherifySdk/models/validation_rules_assignments_list_response_body' require 'VoucherifySdk/models/validation_rules_create_request_body' +require 'VoucherifySdk/models/validation_rules_create_request_body_applicable_to' +require 'VoucherifySdk/models/validation_rules_create_request_body_error' require 'VoucherifySdk/models/validation_rules_create_response_body' +require 'VoucherifySdk/models/validation_rules_create_response_body_applicable_to' +require 'VoucherifySdk/models/validation_rules_create_response_body_error' require 'VoucherifySdk/models/validation_rules_get_response_body' +require 'VoucherifySdk/models/validation_rules_get_response_body_applicable_to' +require 'VoucherifySdk/models/validation_rules_get_response_body_error' require 'VoucherifySdk/models/validation_rules_list_response_body' require 'VoucherifySdk/models/validation_rules_update_request_body' +require 'VoucherifySdk/models/validation_rules_update_request_body_applicable_to' +require 'VoucherifySdk/models/validation_rules_update_request_body_error' require 'VoucherifySdk/models/validation_rules_update_response_body' -require 'VoucherifySdk/models/validations_redeemable_applicable' -require 'VoucherifySdk/models/validations_redeemable_applicable_result' +require 'VoucherifySdk/models/validation_rules_update_response_body_applicable_to' +require 'VoucherifySdk/models/validation_rules_update_response_body_error' require 'VoucherifySdk/models/validations_redeemable_inapplicable' require 'VoucherifySdk/models/validations_redeemable_inapplicable_result' +require 'VoucherifySdk/models/validations_redeemable_inapplicable_result_details' require 'VoucherifySdk/models/validations_redeemable_skipped' -require 'VoucherifySdk/models/validations_validate_all_response_body_redeemables_item' +require 'VoucherifySdk/models/validations_redeemable_skipped_result' +require 'VoucherifySdk/models/validations_redeemable_skipped_result_details' require 'VoucherifySdk/models/validations_validate_request_body' +require 'VoucherifySdk/models/validations_validate_request_body_options' +require 'VoucherifySdk/models/validations_validate_request_body_redeemables_item' +require 'VoucherifySdk/models/validations_validate_request_body_redeemables_item_gift' +require 'VoucherifySdk/models/validations_validate_request_body_redeemables_item_reward' require 'VoucherifySdk/models/validations_validate_response_body' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item_result' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_details' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount_product' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_gift' +require 'VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_loyalty_card' +require 'VoucherifySdk/models/validity_hours' +require 'VoucherifySdk/models/validity_hours_daily_item' +require 'VoucherifySdk/models/validity_timeframe' require 'VoucherifySdk/models/voucher' require 'VoucherifySdk/models/voucher_assets' +require 'VoucherifySdk/models/voucher_assets_barcode' +require 'VoucherifySdk/models/voucher_assets_qr' require 'VoucherifySdk/models/voucher_gift' require 'VoucherifySdk/models/voucher_loyalty_card' require 'VoucherifySdk/models/voucher_publish' @@ -657,28 +892,64 @@ require 'VoucherifySdk/models/voucher_transaction_details_reward' require 'VoucherifySdk/models/voucher_transaction_details_rollback' require 'VoucherifySdk/models/voucher_transaction_details_segment' -require 'VoucherifySdk/models/voucher_transactions_export' require 'VoucherifySdk/models/voucher_transactions_export_filter_conditions' require 'VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id' require 'VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id_conditions' require 'VoucherifySdk/models/voucher_transactions_export_parameters' -require 'VoucherifySdk/models/voucher_transactions_export_result' require 'VoucherifySdk/models/voucher_transactions_filters' -require 'VoucherifySdk/models/voucher_validity_timeframe' +require 'VoucherifySdk/models/voucher_with_categories' +require 'VoucherifySdk/models/voucher_with_categories_gift' +require 'VoucherifySdk/models/voucher_with_categories_loyalty_card' +require 'VoucherifySdk/models/voucher_with_categories_publish' +require 'VoucherifySdk/models/voucher_with_categories_redemption' require 'VoucherifySdk/models/vouchers_balance_update_request_body' require 'VoucherifySdk/models/vouchers_balance_update_response_body' require 'VoucherifySdk/models/vouchers_balance_update_response_body_related_object' +require 'VoucherifySdk/models/vouchers_create_response_body' +require 'VoucherifySdk/models/vouchers_create_response_body_gift' +require 'VoucherifySdk/models/vouchers_create_response_body_loyalty_card' +require 'VoucherifySdk/models/vouchers_create_response_body_publish' +require 'VoucherifySdk/models/vouchers_create_response_body_redemption' +require 'VoucherifySdk/models/vouchers_create_with_specific_code_request_body' +require 'VoucherifySdk/models/vouchers_create_with_specific_code_request_body_redemption' require 'VoucherifySdk/models/vouchers_disable_response_body' +require 'VoucherifySdk/models/vouchers_disable_response_body_gift' +require 'VoucherifySdk/models/vouchers_disable_response_body_loyalty_card' +require 'VoucherifySdk/models/vouchers_disable_response_body_publish' +require 'VoucherifySdk/models/vouchers_disable_response_body_redemption' require 'VoucherifySdk/models/vouchers_enable_response_body' +require 'VoucherifySdk/models/vouchers_enable_response_body_gift' +require 'VoucherifySdk/models/vouchers_enable_response_body_loyalty_card' +require 'VoucherifySdk/models/vouchers_enable_response_body_publish' +require 'VoucherifySdk/models/vouchers_enable_response_body_redemption' require 'VoucherifySdk/models/vouchers_get_response_body' +require 'VoucherifySdk/models/vouchers_get_response_body_gift' +require 'VoucherifySdk/models/vouchers_get_response_body_loyalty_card' +require 'VoucherifySdk/models/vouchers_get_response_body_publish' +require 'VoucherifySdk/models/vouchers_get_response_body_redemption' +require 'VoucherifySdk/models/vouchers_import_create_item_request_body' +require 'VoucherifySdk/models/vouchers_import_create_item_request_body_redemption' +require 'VoucherifySdk/models/vouchers_import_create_response_body' require 'VoucherifySdk/models/vouchers_import_csv_create_response_body' +require 'VoucherifySdk/models/vouchers_list_response_body' +require 'VoucherifySdk/models/vouchers_metadata_update_in_bulk_request_body' +require 'VoucherifySdk/models/vouchers_metadata_update_in_bulk_response_body' require 'VoucherifySdk/models/vouchers_redemption_get_response_body' -require 'VoucherifySdk/models/vouchers_redemption_get_response_body_redemption_entries_item' require 'VoucherifySdk/models/vouchers_transactions_export_create_request_body' require 'VoucherifySdk/models/vouchers_transactions_export_create_response_body' +require 'VoucherifySdk/models/vouchers_transactions_export_create_response_body_result' require 'VoucherifySdk/models/vouchers_transactions_list_response_body' +require 'VoucherifySdk/models/vouchers_update_in_bulk_item_request_body' +require 'VoucherifySdk/models/vouchers_update_in_bulk_response_body' +require 'VoucherifySdk/models/vouchers_update_request_body' +require 'VoucherifySdk/models/vouchers_update_response_body' +require 'VoucherifySdk/models/vouchers_update_response_body_gift' +require 'VoucherifySdk/models/vouchers_update_response_body_loyalty_card' +require 'VoucherifySdk/models/vouchers_update_response_body_publish' +require 'VoucherifySdk/models/vouchers_update_response_body_redemption' # APIs +require 'VoucherifySdk/api/async_actions_api' require 'VoucherifySdk/api/campaigns_api' require 'VoucherifySdk/api/categories_api' require 'VoucherifySdk/api/client_side_api' diff --git a/lib/VoucherifySdk/api/async_actions_api.rb b/lib/VoucherifySdk/api/async_actions_api.rb new file mode 100644 index 00000000..80b7d4ec --- /dev/null +++ b/lib/VoucherifySdk/api/async_actions_api.rb @@ -0,0 +1,144 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'cgi' + +module VoucherifySdk + class AsyncActionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get Async Action + # Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + # @param async_action_id [String] Unique ID of the asynchronous operation. + # @param [Hash] opts the optional parameters + # @return [AsyncActionGetResponseBody] + def get_async_action(async_action_id, opts = {}) + data, _status_code, _headers = get_async_action_with_http_info(async_action_id, opts) + data + end + + # Get Async Action + # Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + # @param async_action_id [String] Unique ID of the asynchronous operation. + # @param [Hash] opts the optional parameters + # @return [Array<(AsyncActionGetResponseBody, Integer, Hash)>] AsyncActionGetResponseBody data, response status code and response headers + private def get_async_action_with_http_info(async_action_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AsyncActionsApi.get_async_action ...' + end + # resource path + local_var_path = '/v1/async-actions/{asyncActionId}'.sub('{' + 'asyncActionId' + '}', CGI.escape(async_action_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AsyncActionGetResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"AsyncActionsApi.get_async_action", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AsyncActionsApi#get_async_action\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Async Actions + # Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limit the number of asynchronous actions that the API returns in the response. + # @option opts [Time] :end_date Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). + # @return [AsyncActionsListResponseBody] + def list_async_actions(opts = {}) + data, _status_code, _headers = list_async_actions_with_http_info(opts) + data + end + + # List Async Actions + # Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limit the number of asynchronous actions that the API returns in the response. + # @option opts [Time] :end_date Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). + # @return [Array<(AsyncActionsListResponseBody, Integer, Hash)>] AsyncActionsListResponseBody data, response status code and response headers + private def list_async_actions_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AsyncActionsApi.list_async_actions ...' + end + # resource path + local_var_path = '/v1/async-actions' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AsyncActionsListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"AsyncActionsApi.list_async_actions", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AsyncActionsApi#list_async_actions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/VoucherifySdk/api/campaigns_api.rb b/lib/VoucherifySdk/api/campaigns_api.rb index 2cb2d0c3..b9f4fea0 100644 --- a/lib/VoucherifySdk/api/campaigns_api.rb +++ b/lib/VoucherifySdk/api/campaigns_api.rb @@ -42,14 +42,6 @@ def add_voucher_with_specific_code_to_campaign(campaign_id, code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.add_voucher_with_specific_code_to_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.add_voucher_with_specific_code_to_campaign" - end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling CampaignsApi.add_voucher_with_specific_code_to_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}/vouchers/{code}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -101,7 +93,7 @@ def add_voucher_with_specific_code_to_campaign(campaign_id, code, opts = {}) # @param [Hash] opts the optional parameters # @option opts [Integer] :vouchers_count Number of vouchers that should be added. # @option opts [CampaignsVouchersCreateInBulkRequestBody] :campaigns_vouchers_create_in_bulk_request_body Specify the voucher parameters that you would like to overwrite. - # @return [CampaignsVouchersCreateResponseBody] + # @return [CampaignsVouchersCreateCombinedResponseBody] def add_vouchers_to_campaign(campaign_id, opts = {}) data, _status_code, _headers = add_vouchers_to_campaign_with_http_info(campaign_id, opts) data @@ -113,15 +105,11 @@ def add_vouchers_to_campaign(campaign_id, opts = {}) # @param [Hash] opts the optional parameters # @option opts [Integer] :vouchers_count Number of vouchers that should be added. # @option opts [CampaignsVouchersCreateInBulkRequestBody] :campaigns_vouchers_create_in_bulk_request_body Specify the voucher parameters that you would like to overwrite. - # @return [Array<(CampaignsVouchersCreateResponseBody, Integer, Hash)>] CampaignsVouchersCreateResponseBody data, response status code and response headers + # @return [Array<(CampaignsVouchersCreateCombinedResponseBody, Integer, Hash)>] CampaignsVouchersCreateCombinedResponseBody data, response status code and response headers private def add_vouchers_to_campaign_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.add_vouchers_to_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.add_vouchers_to_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}/vouchers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -146,7 +134,7 @@ def add_vouchers_to_campaign(campaign_id, opts = {}) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'campaigns_vouchers_create_in_bulk_request_body']) # return_type - return_type = opts[:debug_return_type] || 'CampaignsVouchersCreateResponseBody' + return_type = opts[:debug_return_type] || 'CampaignsVouchersCreateCombinedResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] @@ -233,10 +221,10 @@ def create_campaign(opts = {}) end # Delete Campaign - # Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. # @param campaign_id [String] You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name. + # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. # @return [CampaignsDeleteResponseBody] def delete_campaign(campaign_id, opts = {}) data, _status_code, _headers = delete_campaign_with_http_info(campaign_id, opts) @@ -244,19 +232,15 @@ def delete_campaign(campaign_id, opts = {}) end # Delete Campaign - # Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. # @param campaign_id [String] You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name. + # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. # @return [Array<(CampaignsDeleteResponseBody, Integer, Hash)>] CampaignsDeleteResponseBody data, response status code and response headers private def delete_campaign_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.delete_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.delete_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -302,7 +286,7 @@ def delete_campaign(campaign_id, opts = {}) # There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. # @param campaign_id [String] The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. # @param [Hash] opts the optional parameters - # @return [CampaignsDisableResponseBody] + # @return [Object] def disable_campaign(campaign_id, opts = {}) data, _status_code, _headers = disable_campaign_with_http_info(campaign_id, opts) data @@ -312,15 +296,11 @@ def disable_campaign(campaign_id, opts = {}) # There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. # @param campaign_id [String] The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. # @param [Hash] opts the optional parameters - # @return [Array<(CampaignsDisableResponseBody, Integer, Hash)>] CampaignsDisableResponseBody data, response status code and response headers + # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers private def disable_campaign_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.disable_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.disable_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}/disable'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -339,7 +319,7 @@ def disable_campaign(campaign_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'CampaignsDisableResponseBody' + return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] @@ -365,7 +345,7 @@ def disable_campaign(campaign_id, opts = {}) # There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. # @param campaign_id [String] The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. # @param [Hash] opts the optional parameters - # @return [CampaignsEnableResponseBody] + # @return [Object] def enable_campaign(campaign_id, opts = {}) data, _status_code, _headers = enable_campaign_with_http_info(campaign_id, opts) data @@ -375,15 +355,11 @@ def enable_campaign(campaign_id, opts = {}) # There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. # @param campaign_id [String] The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. # @param [Hash] opts the optional parameters - # @return [Array<(CampaignsEnableResponseBody, Integer, Hash)>] CampaignsEnableResponseBody data, response status code and response headers + # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers private def enable_campaign_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.enable_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.enable_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}/enable'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -402,7 +378,7 @@ def enable_campaign(campaign_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'CampaignsEnableResponseBody' + return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] @@ -443,10 +419,6 @@ def get_campaign(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.get_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.get_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -508,10 +480,6 @@ def import_vouchers_to_campaign(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.import_vouchers_to_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.import_vouchers_to_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}/import'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -560,32 +528,24 @@ def import_vouchers_to_campaign(campaign_id, opts = {}) # Import Vouchers to Campaign by CSV # Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. # @param campaign_id [String] The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [CampaignsImportCsvCreateResponseBody] - def import_vouchers_to_campaign_using_csv(campaign_id, file, opts = {}) - data, _status_code, _headers = import_vouchers_to_campaign_using_csv_with_http_info(campaign_id, file, opts) + def import_vouchers_to_campaign_using_csv(campaign_id, opts = {}) + data, _status_code, _headers = import_vouchers_to_campaign_using_csv_with_http_info(campaign_id, opts) data end # Import Vouchers to Campaign by CSV # Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. # @param campaign_id [String] The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [Array<(CampaignsImportCsvCreateResponseBody, Integer, Hash)>] CampaignsImportCsvCreateResponseBody data, response status code and response headers - private def import_vouchers_to_campaign_using_csv_with_http_info(campaign_id, file, opts = {}) + private def import_vouchers_to_campaign_using_csv_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.import_vouchers_to_campaign_using_csv ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.import_vouchers_to_campaign_using_csv" - end - # verify the required parameter 'file' is set - if @api_client.config.client_side_validation && file.nil? - fail ArgumentError, "Missing the required parameter 'file' when calling CampaignsApi.import_vouchers_to_campaign_using_csv" - end # resource path local_var_path = '/v1/campaigns/{campaignId}/importCSV'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -604,7 +564,7 @@ def import_vouchers_to_campaign_using_csv(campaign_id, file, opts = {}) # form parameters form_params = opts[:form_params] || {} - form_params['file'] = file + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] @@ -635,8 +595,8 @@ def import_vouchers_to_campaign_using_csv(campaign_id, file, opts = {}) # List Campaigns # Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterCampaignType] :campaign_type This attribute allows filtering by campaign type. # @option opts [ParameterExpandListCampaigns] :expand Include an expanded categories object in the response. (default to 'category') # @option opts [ParameterOrderListCampaigns] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @@ -649,8 +609,8 @@ def list_campaigns(opts = {}) # List Campaigns # Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterCampaignType] :campaign_type This attribute allows filtering by campaign type. # @option opts [ParameterExpandListCampaigns] :expand Include an expanded categories object in the response. (default to 'category') # @option opts [ParameterOrderListCampaigns] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @@ -659,18 +619,6 @@ def list_campaigns(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.list_campaigns ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CampaignsApi.list_campaigns, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CampaignsApi.list_campaigns, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling CampaignsApi.list_campaigns, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/campaigns' @@ -737,10 +685,6 @@ def update_campaign(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CampaignsApi.update_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling CampaignsApi.update_campaign" - end # resource path local_var_path = '/v1/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) diff --git a/lib/VoucherifySdk/api/categories_api.rb b/lib/VoucherifySdk/api/categories_api.rb index 36a0a9ce..f54eab1c 100644 --- a/lib/VoucherifySdk/api/categories_api.rb +++ b/lib/VoucherifySdk/api/categories_api.rb @@ -102,10 +102,6 @@ def delete_category(category_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.delete_category ...' end - # verify the required parameter 'category_id' is set - if @api_client.config.client_side_validation && category_id.nil? - fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.delete_category" - end # resource path local_var_path = '/v1/categories/{categoryId}'.sub('{' + 'categoryId' + '}', CGI.escape(category_id.to_s)) @@ -163,10 +159,6 @@ def get_category(category_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.get_category ...' end - # verify the required parameter 'category_id' is set - if @api_client.config.client_side_validation && category_id.nil? - fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_category" - end # resource path local_var_path = '/v1/categories/{categoryId}'.sub('{' + 'categoryId' + '}', CGI.escape(category_id.to_s)) @@ -285,10 +277,6 @@ def update_category(category_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.update_category ...' end - # verify the required parameter 'category_id' is set - if @api_client.config.client_side_validation && category_id.nil? - fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.update_category" - end # resource path local_var_path = '/v1/categories/{categoryId}'.sub('{' + 'categoryId' + '}', CGI.escape(category_id.to_s)) diff --git a/lib/VoucherifySdk/api/client_side_api.rb b/lib/VoucherifySdk/api/client_side_api.rb index 88e9a828..7f71607f 100644 --- a/lib/VoucherifySdk/api/client_side_api.rb +++ b/lib/VoucherifySdk/api/client_side_api.rb @@ -83,62 +83,63 @@ def check_eligibility_client_side(opts = {}) return data, status_code, headers end - # Redeem Stackable Discounts (client-side) - # This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + # List Promotion Tiers (client-side) + # This method enables you to list promotion tiers. # @param origin [String] Indicates the origin (scheme, hostname, and port). # @param [Hash] opts the optional parameters - # @option opts [ClientRedemptionsRedeemRequestBody] :client_redemptions_redeem_request_body - # @return [ClientRedemptionsRedeemResponseBody] - def redeem_stacked_discounts_client_side(origin, opts = {}) - data, _status_code, _headers = redeem_stacked_discounts_client_side_with_http_info(origin, opts) + # @option opts [Boolean] :is_available This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListPromotionTiersClientSide] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [ClientPromotionsTiersListResponseBody] + def list_promotion_tiers_client_side(origin, opts = {}) + data, _status_code, _headers = list_promotion_tiers_client_side_with_http_info(origin, opts) data end - # Redeem Stackable Discounts (client-side) - # This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + # List Promotion Tiers (client-side) + # This method enables you to list promotion tiers. # @param origin [String] Indicates the origin (scheme, hostname, and port). # @param [Hash] opts the optional parameters - # @option opts [ClientRedemptionsRedeemRequestBody] :client_redemptions_redeem_request_body - # @return [Array<(ClientRedemptionsRedeemResponseBody, Integer, Hash)>] ClientRedemptionsRedeemResponseBody data, response status code and response headers - private def redeem_stacked_discounts_client_side_with_http_info(origin, opts = {}) + # @option opts [Boolean] :is_available This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListPromotionTiersClientSide] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [Array<(ClientPromotionsTiersListResponseBody, Integer, Hash)>] ClientPromotionsTiersListResponseBody data, response status code and response headers + private def list_promotion_tiers_client_side_with_http_info(origin, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ClientSideApi.redeem_stacked_discounts_client_side ...' - end - # verify the required parameter 'origin' is set - if @api_client.config.client_side_validation && origin.nil? - fail ArgumentError, "Missing the required parameter 'origin' when calling ClientSideApi.redeem_stacked_discounts_client_side" + @api_client.config.logger.debug 'Calling API: ClientSideApi.list_promotion_tiers_client_side ...' end # resource path - local_var_path = '/client/v1/redemptions' + local_var_path = '/client/v1/promotions/tiers' # query parameters query_params = opts[:query_params] || {} + query_params[:'is_available'] = opts[:'is_available'] if !opts[:'is_available'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) - # HTTP header 'Content-Type' - content_type = @api_client.select_header_content_type(['application/json']) - if !content_type.nil? - header_params['Content-Type'] = content_type - end header_params[:'origin'] = origin # form parameters form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'client_redemptions_redeem_request_body']) + post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'ClientRedemptionsRedeemResponseBody' + return_type = opts[:debug_return_type] || 'ClientPromotionsTiersListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-Client-Application-Id', 'X-Client-Token'] new_options = opts.merge( - :operation => :"ClientSideApi.redeem_stacked_discounts_client_side", + :operation => :"ClientSideApi.list_promotion_tiers_client_side", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -147,40 +148,36 @@ def redeem_stacked_discounts_client_side(origin, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ClientSideApi#redeem_stacked_discounts_client_side\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ClientSideApi#list_promotion_tiers_client_side\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Track Custom Event (client-side) - # To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + # Redeem Stackable Discounts (client-side) + # This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. # @param origin [String] Indicates the origin (scheme, hostname, and port). # @param [Hash] opts the optional parameters - # @option opts [ClientEventsCreateRequestBody] :client_events_create_request_body Specify the details of the custom event. - # @return [ClientEventsCreateResponseBody] - def track_custom_event_client_side(origin, opts = {}) - data, _status_code, _headers = track_custom_event_client_side_with_http_info(origin, opts) + # @option opts [ClientRedemptionsRedeemRequestBody] :client_redemptions_redeem_request_body + # @return [ClientRedemptionsRedeemResponseBody] + def redeem_stacked_discounts_client_side(origin, opts = {}) + data, _status_code, _headers = redeem_stacked_discounts_client_side_with_http_info(origin, opts) data end - # Track Custom Event (client-side) - # To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + # Redeem Stackable Discounts (client-side) + # This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. # @param origin [String] Indicates the origin (scheme, hostname, and port). # @param [Hash] opts the optional parameters - # @option opts [ClientEventsCreateRequestBody] :client_events_create_request_body Specify the details of the custom event. - # @return [Array<(ClientEventsCreateResponseBody, Integer, Hash)>] ClientEventsCreateResponseBody data, response status code and response headers - private def track_custom_event_client_side_with_http_info(origin, opts = {}) + # @option opts [ClientRedemptionsRedeemRequestBody] :client_redemptions_redeem_request_body + # @return [Array<(ClientRedemptionsRedeemResponseBody, Integer, Hash)>] ClientRedemptionsRedeemResponseBody data, response status code and response headers + private def redeem_stacked_discounts_client_side_with_http_info(origin, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ClientSideApi.track_custom_event_client_side ...' - end - # verify the required parameter 'origin' is set - if @api_client.config.client_side_validation && origin.nil? - fail ArgumentError, "Missing the required parameter 'origin' when calling ClientSideApi.track_custom_event_client_side" + @api_client.config.logger.debug 'Calling API: ClientSideApi.redeem_stacked_discounts_client_side ...' end # resource path - local_var_path = '/client/v1/events' + local_var_path = '/client/v1/redemptions' # query parameters query_params = opts[:query_params] || {} @@ -200,16 +197,16 @@ def track_custom_event_client_side(origin, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'client_events_create_request_body']) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'client_redemptions_redeem_request_body']) # return_type - return_type = opts[:debug_return_type] || 'ClientEventsCreateResponseBody' + return_type = opts[:debug_return_type] || 'ClientRedemptionsRedeemResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-Client-Application-Id', 'X-Client-Token'] new_options = opts.merge( - :operation => :"ClientSideApi.track_custom_event_client_side", + :operation => :"ClientSideApi.redeem_stacked_discounts_client_side", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -220,64 +217,63 @@ def track_custom_event_client_side(origin, opts = {}) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ClientSideApi#track_custom_event_client_side\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ClientSideApi#redeem_stacked_discounts_client_side\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Update Customer's consents (client-side) - # Update marketing permissions for the specified customer. - # @param customer_id [String] A Voucherify customer identifier or source_id + # Track Custom Event (client-side) + # To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + # @param origin [String] Indicates the origin (scheme, hostname, and port). # @param [Hash] opts the optional parameters - # @option opts [Object] :body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: - # @return [nil] - def update_customers_consents_client_side(customer_id, opts = {}) - update_customers_consents_client_side_with_http_info(customer_id, opts) - nil + # @option opts [ClientEventsCreateRequestBody] :client_events_create_request_body Specify the details of the custom event. + # @return [ClientEventsCreateResponseBody] + def track_custom_event_client_side(origin, opts = {}) + data, _status_code, _headers = track_custom_event_client_side_with_http_info(origin, opts) + data end - # Update Customer's consents (client-side) - # Update marketing permissions for the specified customer. - # @param customer_id [String] A Voucherify customer identifier or source_id + # Track Custom Event (client-side) + # To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + # @param origin [String] Indicates the origin (scheme, hostname, and port). # @param [Hash] opts the optional parameters - # @option opts [Object] :body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - private def update_customers_consents_client_side_with_http_info(customer_id, opts = {}) + # @option opts [ClientEventsCreateRequestBody] :client_events_create_request_body Specify the details of the custom event. + # @return [Array<(ClientEventsCreateResponseBody, Integer, Hash)>] ClientEventsCreateResponseBody data, response status code and response headers + private def track_custom_event_client_side_with_http_info(origin, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ClientSideApi.update_customers_consents_client_side ...' - end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling ClientSideApi.update_customers_consents_client_side" + @api_client.config.logger.debug 'Calling API: ClientSideApi.track_custom_event_client_side ...' end # resource path - local_var_path = '/client/v1/customers/{customerId}/consents'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) + local_var_path = '/client/v1/events' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end + header_params[:'origin'] = origin # form parameters form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'client_events_create_request_body']) # return_type - return_type = opts[:debug_return_type] + return_type = opts[:debug_return_type] || 'ClientEventsCreateResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-Client-Application-Id', 'X-Client-Token'] new_options = opts.merge( - :operation => :"ClientSideApi.update_customers_consents_client_side", + :operation => :"ClientSideApi.track_custom_event_client_side", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -286,9 +282,9 @@ def update_customers_consents_client_side(customer_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ClientSideApi#update_customers_consents_client_side\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ClientSideApi#track_custom_event_client_side\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -314,10 +310,6 @@ def validate_stacked_discounts_client_side(origin, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientSideApi.validate_stacked_discounts_client_side ...' end - # verify the required parameter 'origin' is set - if @api_client.config.client_side_validation && origin.nil? - fail ArgumentError, "Missing the required parameter 'origin' when calling ClientSideApi.validate_stacked_discounts_client_side" - end # resource path local_var_path = '/client/v1/validations' diff --git a/lib/VoucherifySdk/api/customers_api.rb b/lib/VoucherifySdk/api/customers_api.rb index 2a46f99e..3678b713 100644 --- a/lib/VoucherifySdk/api/customers_api.rb +++ b/lib/VoucherifySdk/api/customers_api.rb @@ -102,10 +102,6 @@ def customer_permanently_deletion(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.customer_permanently_deletion ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.customer_permanently_deletion" - end # resource path local_var_path = '/v1/customers/{customerId}/permanent-deletion'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -165,10 +161,6 @@ def delete_customer(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.delete_customer ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.delete_customer" - end # resource path local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -226,10 +218,6 @@ def get_customer(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.get_customer ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.get_customer" - end # resource path local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -272,27 +260,23 @@ def get_customer(customer_id, opts = {}) # Import and Update Customers using CSV # This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. 📘 Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [CustomersImportCsvCreateResponseBody] - def import_customers_using_csv(file, opts = {}) - data, _status_code, _headers = import_customers_using_csv_with_http_info(file, opts) + def import_customers_using_csv(opts = {}) + data, _status_code, _headers = import_customers_using_csv_with_http_info(opts) data end # Import and Update Customers using CSV # This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. 📘 Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [Array<(CustomersImportCsvCreateResponseBody, Integer, Hash)>] CustomersImportCsvCreateResponseBody data, response status code and response headers - private def import_customers_using_csv_with_http_info(file, opts = {}) + private def import_customers_using_csv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.import_customers_using_csv ...' end - # verify the required parameter 'file' is set - if @api_client.config.client_side_validation && file.nil? - fail ArgumentError, "Missing the required parameter 'file' when calling CustomersApi.import_customers_using_csv" - end # resource path local_var_path = '/v1/customers/importCSV' @@ -311,7 +295,7 @@ def import_customers_using_csv(file, opts = {}) # form parameters form_params = opts[:form_params] || {} - form_params['file'] = file + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] @@ -339,14 +323,14 @@ def import_customers_using_csv(file, opts = {}) return data, status_code, headers end - # List Customer Activities - # Retrieve customer activities. + # List Customer Activities [Deprecated] + # > ❗️ Deprecated This endpoint represents the deprecated version of the API responsible for listing customer activities and we do not recommend using it. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. Retrieve customer activities. # @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. - # @option opts [Time] :starting_after A cursor for use in pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. - # @option opts [String] :starting_after_id By applying this filter value, you will get events starting after an event with the given ID. + # @option opts [Time] :starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. # @option opts [ParameterCampaignType] :campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM # @option opts [String] :campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. # @option opts [String] :product_id By applying this parameter you request only events related to specific product identified by its ID. @@ -358,14 +342,14 @@ def list_customer_activities(customer_id, opts = {}) data end - # List Customer Activities - # Retrieve customer activities. + # List Customer Activities [Deprecated] + # > ❗️ Deprecated This endpoint represents the deprecated version of the API responsible for listing customer activities and we do not recommend using it. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. Retrieve customer activities. # @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. - # @option opts [Time] :starting_after A cursor for use in pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. - # @option opts [String] :starting_after_id By applying this filter value, you will get events starting after an event with the given ID. + # @option opts [Time] :starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. # @option opts [ParameterCampaignType] :campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM # @option opts [String] :campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. # @option opts [String] :product_id By applying this parameter you request only events related to specific product identified by its ID. @@ -376,18 +360,6 @@ def list_customer_activities(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_activities ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.list_customer_activities" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomersApi.list_customer_activities, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomersApi.list_customer_activities, must be greater than or equal to 1.' - end - # resource path local_var_path = '/v1/customers/{customerId}/activities'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -437,6 +409,163 @@ def list_customer_activities(customer_id, opts = {}) return data, status_code, headers end + # List Customer Activity + # Retrieve customer activities. + # @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @option opts [Time] :start_date Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. + # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + # @option opts [String] :campaign_id Requests only events related to specific campaign identified by its ID. + # @option opts [ParameterCampaignType] :campaign_type Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. + # @option opts [ParameterActivityCategory] :category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. + # @option opts [String] :type Event name of the customer event. + # @return [CustomersActivityListResponseBody] + def list_customer_activity(customer_id, opts = {}) + data, _status_code, _headers = list_customer_activity_with_http_info(customer_id, opts) + data + end + + # List Customer Activity + # Retrieve customer activities. + # @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @option opts [Time] :start_date Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. + # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + # @option opts [String] :campaign_id Requests only events related to specific campaign identified by its ID. + # @option opts [ParameterCampaignType] :campaign_type Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. + # @option opts [ParameterActivityCategory] :category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. + # @option opts [String] :type Event name of the customer event. + # @return [Array<(CustomersActivityListResponseBody, Integer, Hash)>] CustomersActivityListResponseBody data, response status code and response headers + private def list_customer_activity_with_http_info(customer_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_activity ...' + end + # resource path + local_var_path = '/v1/customers/{customerId}/activity'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil? + query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? + query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? + query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? + query_params[:'campaign_type'] = opts[:'campaign_type'] if !opts[:'campaign_type'].nil? + query_params[:'category'] = opts[:'category'] if !opts[:'category'].nil? + query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomersActivityListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"CustomersApi.list_customer_activity", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#list_customer_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Customer's Redeemables + # Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + # @param customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderListRedeemables] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @option opts [ParameterFiltersListCustomerRedeemables] :filters Filters for listing customer redeemables. + # @return [CustomersRedeemablesListResponseBody] + def list_customer_redeemables(customer_id, opts = {}) + data, _status_code, _headers = list_customer_redeemables_with_http_info(customer_id, opts) + data + end + + # List Customer's Redeemables + # Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + # @param customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderListRedeemables] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @option opts [ParameterFiltersListCustomerRedeemables] :filters Filters for listing customer redeemables. + # @return [Array<(CustomersRedeemablesListResponseBody, Integer, Hash)>] CustomersRedeemablesListResponseBody data, response status code and response headers + private def list_customer_redeemables_with_http_info(customer_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_redeemables ...' + end + # resource path + local_var_path = '/v1/customers/{customerId}/redeemables'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil? + query_params[:'filters'] = opts[:'filters'] if !opts[:'filters'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomersRedeemablesListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"CustomersApi.list_customer_redeemables", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#list_customer_redeemables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List Customer's Segments # Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. # @param customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. @@ -456,10 +585,6 @@ def list_customer_segments(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_segments ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.list_customer_segments" - end # resource path local_var_path = '/v1/customers/{customerId}/segments'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -503,8 +628,8 @@ def list_customer_segments(customer_id, opts = {}) # List Customers # Returns a list of customers. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [String] :email Limit the customers to the ones that have this specific email address. # @option opts [String] :city Limit the customers to the ones that are located in the specified city. # @option opts [String] :name Filter customers by the name property. @@ -514,7 +639,7 @@ def list_customer_segments(customer_id, opts = {}) # @option opts [Time] :updated_at_before Filter customers by date customer was updated last time. # @option opts [Time] :updated_at_after Filter customers by date customer was updated last time. # @option opts [ParameterOrderListCustomers] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. - # @option opts [Time] :starting_after A cursor for use in pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + # @option opts [Time] :starting_after A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. # @return [CustomersListResponseBody] def list_customers(opts = {}) data, _status_code, _headers = list_customers_with_http_info(opts) @@ -524,8 +649,8 @@ def list_customers(opts = {}) # List Customers # Returns a list of customers. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [String] :email Limit the customers to the ones that have this specific email address. # @option opts [String] :city Limit the customers to the ones that are located in the specified city. # @option opts [String] :name Filter customers by the name property. @@ -535,24 +660,12 @@ def list_customers(opts = {}) # @option opts [Time] :updated_at_before Filter customers by date customer was updated last time. # @option opts [Time] :updated_at_after Filter customers by date customer was updated last time. # @option opts [ParameterOrderListCustomers] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. - # @option opts [Time] :starting_after A cursor for use in pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + # @option opts [Time] :starting_after A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. # @return [Array<(CustomersListResponseBody, Integer, Hash)>] CustomersListResponseBody data, response status code and response headers private def list_customers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customers ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomersApi.list_customers, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomersApi.list_customers, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling CustomersApi.list_customers, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/customers' @@ -626,10 +739,6 @@ def update_customer(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.update_customer" - end # resource path local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -675,8 +784,8 @@ def update_customer(customer_id, opts = {}) return data, status_code, headers end - # Update Customer's consents - # Update marketing permissions for the specified customer. + # Update Customer's consents [Deprecated] + # Update marketing permissions for the specified customer. ❗️ Deprecated This endpoint is deprecated. The feature of managing consents will be soon removed from Voucherify, including this endpoint. # @param customer_id [String] A Voucherify unique customer identifier or source ID. # @param [Hash] opts the optional parameters # @option opts [Object] :body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: @@ -686,8 +795,8 @@ def update_customers_consents(customer_id, opts = {}) nil end - # Update Customer's consents - # Update marketing permissions for the specified customer. + # Update Customer's consents [Deprecated] + # Update marketing permissions for the specified customer. ❗️ Deprecated This endpoint is deprecated. The feature of managing consents will be soon removed from Voucherify, including this endpoint. # @param customer_id [String] A Voucherify unique customer identifier or source ID. # @param [Hash] opts the optional parameters # @option opts [Object] :body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: @@ -696,10 +805,6 @@ def update_customers_consents(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.update_customers_consents ...' end - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomersApi.update_customers_consents" - end # resource path local_var_path = '/v1/customers/{customerId}/consents'.sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s)) @@ -743,20 +848,20 @@ def update_customers_consents(customer_id, opts = {}) return data, status_code, headers end - # Update Customers in bulk - # Update several customers in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Customers in Bulk + # Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [Array] :customers_update_in_bulk_request_body Specify the customer fields that you would like to update in each customer object. + # @option opts [Array] :customers_update_in_bulk_request_body List the customer fields to be updated in each customer object. # @return [CustomersUpdateInBulkResponseBody] def update_customers_in_bulk(opts = {}) data, _status_code, _headers = update_customers_in_bulk_with_http_info(opts) data end - # Update Customers in bulk - # Update several customers in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Customers in Bulk + # Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [Array] :customers_update_in_bulk_request_body Specify the customer fields that you would like to update in each customer object. + # @option opts [Array] :customers_update_in_bulk_request_body List the customer fields to be updated in each customer object. # @return [Array<(CustomersUpdateInBulkResponseBody, Integer, Hash)>] CustomersUpdateInBulkResponseBody data, response status code and response headers private def update_customers_in_bulk_with_http_info(opts = {}) if @api_client.config.debugging @@ -807,20 +912,20 @@ def update_customers_in_bulk(opts = {}) return data, status_code, headers end - # Update Customers' Metadata in bulk - # Update several customers metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Customers' Metadata in Bulk + # Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [CustomersMetadataUpdateInBulkRequestBody] :customers_metadata_update_in_bulk_request_body List the source_ids of the customers you would like to update along with the metadata key value pairs. + # @option opts [CustomersMetadataUpdateInBulkRequestBody] :customers_metadata_update_in_bulk_request_body List the source_ids of the customers you would like to update with the metadata key/value pairs. # @return [CustomersMetadataUpdateInBulkResponseBody] def update_customers_metadata_in_bulk(opts = {}) data, _status_code, _headers = update_customers_metadata_in_bulk_with_http_info(opts) data end - # Update Customers' Metadata in bulk - # Update several customers metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Customers' Metadata in Bulk + # Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [CustomersMetadataUpdateInBulkRequestBody] :customers_metadata_update_in_bulk_request_body List the source_ids of the customers you would like to update along with the metadata key value pairs. + # @option opts [CustomersMetadataUpdateInBulkRequestBody] :customers_metadata_update_in_bulk_request_body List the source_ids of the customers you would like to update with the metadata key/value pairs. # @return [Array<(CustomersMetadataUpdateInBulkResponseBody, Integer, Hash)>] CustomersMetadataUpdateInBulkResponseBody data, response status code and response headers private def update_customers_metadata_in_bulk_with_http_info(opts = {}) if @api_client.config.debugging diff --git a/lib/VoucherifySdk/api/exports_api.rb b/lib/VoucherifySdk/api/exports_api.rb index e1b296d8..585dc5bd 100644 --- a/lib/VoucherifySdk/api/exports_api.rb +++ b/lib/VoucherifySdk/api/exports_api.rb @@ -20,7 +20,7 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Create Export - # Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + # Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions # @param [Hash] opts the optional parameters # @option opts [ExportsCreateRequestBody] :exports_create_request_body Specify the details of the export that you would like to create. # @return [ExportsCreateResponseBody] @@ -30,7 +30,7 @@ def create_export(opts = {}) end # Create Export - # Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + # Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions # @param [Hash] opts the optional parameters # @option opts [ExportsCreateRequestBody] :exports_create_request_body Specify the details of the export that you would like to create. # @return [Array<(ExportsCreateResponseBody, Integer, Hash)>] ExportsCreateResponseBody data, response status code and response headers @@ -102,10 +102,6 @@ def delete_export(export_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ExportsApi.delete_export ...' end - # verify the required parameter 'export_id' is set - if @api_client.config.client_side_validation && export_id.nil? - fail ArgumentError, "Missing the required parameter 'export_id' when calling ExportsApi.delete_export" - end # resource path local_var_path = '/v1/exports/{exportId}'.sub('{' + 'exportId' + '}', CGI.escape(export_id.to_s)) @@ -165,10 +161,6 @@ def download_export(export_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ExportsApi.download_export ...' end - # verify the required parameter 'export_id' is set - if @api_client.config.client_side_validation && export_id.nil? - fail ArgumentError, "Missing the required parameter 'export_id' when calling ExportsApi.download_export" - end # resource path local_var_path = '/v1/exports/{export_Id}'.sub('{' + 'export_Id' + '}', CGI.escape(export_id.to_s)) @@ -229,10 +221,6 @@ def get_export(export_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ExportsApi.get_export ...' end - # verify the required parameter 'export_id' is set - if @api_client.config.client_side_validation && export_id.nil? - fail ArgumentError, "Missing the required parameter 'export_id' when calling ExportsApi.get_export" - end # resource path local_var_path = '/v1/exports/{exportId}'.sub('{' + 'exportId' + '}', CGI.escape(export_id.to_s)) @@ -276,8 +264,8 @@ def get_export(export_id, opts = {}) # List Exports # List all exports. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListExports] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [ExportsListResponseBody] def list_exports(opts = {}) @@ -288,26 +276,14 @@ def list_exports(opts = {}) # List Exports # List all exports. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListExports] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [Array<(ExportsListResponseBody, Integer, Hash)>] ExportsListResponseBody data, response status code and response headers private def list_exports_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ExportsApi.list_exports ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ExportsApi.list_exports, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ExportsApi.list_exports, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExportsApi.list_exports, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/exports' diff --git a/lib/VoucherifySdk/api/loyalties_api.rb b/lib/VoucherifySdk/api/loyalties_api.rb index d3787b95..1e4d97b1 100644 --- a/lib/VoucherifySdk/api/loyalties_api.rb +++ b/lib/VoucherifySdk/api/loyalties_api.rb @@ -19,6 +19,138 @@ class LoyaltiesApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Add Member + # This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. 📘 Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + # @param campaign_id [String] Unique campaign ID of the loyalty program. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesMembersCreateRequestBody] :loyalties_members_create_request_body Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. + # @return [LoyaltiesMembersCreateResponseBody] + def add_member(campaign_id, opts = {}) + data, _status_code, _headers = add_member_with_http_info(campaign_id, opts) + data + end + + # Add Member + # This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. 📘 Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + # @param campaign_id [String] Unique campaign ID of the loyalty program. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesMembersCreateRequestBody] :loyalties_members_create_request_body Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. + # @return [Array<(LoyaltiesMembersCreateResponseBody, Integer, Hash)>] LoyaltiesMembersCreateResponseBody data, response status code and response headers + private def add_member_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.add_member ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/members'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_members_create_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMembersCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.add_member", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#add_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Earning Rule + # Create earning rules for a loyalty campaign. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [Array] :loyalties_earning_rules_create_request_body_item Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object + # @return [Array] + def create_earning_rule(campaign_id, opts = {}) + data, _status_code, _headers = create_earning_rule_with_http_info(campaign_id, opts) + data + end + + # Create Earning Rule + # Create earning rules for a loyalty campaign. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [Array] :loyalties_earning_rules_create_request_body_item Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + private def create_earning_rule_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.create_earning_rule ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/earning-rules'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_earning_rules_create_request_body_item']) + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.create_earning_rule", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#create_earning_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create loyalty tiers # Creates loyalty tiers for desired campaign. # @param campaign_id [String] Unique loyalty campaign ID or name. @@ -40,10 +172,6 @@ def create_in_bulk_loyalty_tiers(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.create_in_bulk_loyalty_tiers ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.create_in_bulk_loyalty_tiers" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -89,6 +217,202 @@ def create_in_bulk_loyalty_tiers(campaign_id, opts = {}) return data, status_code, headers end + # Create Loyalty Campaign + # Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. 📘 Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. 🚧 Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesCreateCampaignRequestBody] :loyalties_create_campaign_request_body Specify the loyalty campaign details. + # @return [LoyaltiesCreateCampaignResponseBody] + def create_loyalty_program(opts = {}) + data, _status_code, _headers = create_loyalty_program_with_http_info(opts) + data + end + + # Create Loyalty Campaign + # Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. 📘 Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. 🚧 Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesCreateCampaignRequestBody] :loyalties_create_campaign_request_body Specify the loyalty campaign details. + # @return [Array<(LoyaltiesCreateCampaignResponseBody, Integer, Hash)>] LoyaltiesCreateCampaignResponseBody data, response status code and response headers + private def create_loyalty_program_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.create_loyalty_program ...' + end + # resource path + local_var_path = '/v1/loyalties' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_create_campaign_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesCreateCampaignResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.create_loyalty_program", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#create_loyalty_program\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Points Expiration Export + # Schedule the generation of a points expiration CSV file for a particular campaign. + # @param campaign_id [String] Unique campaign ID or name. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesPointsExpirationExportCreateRequestBody] :loyalties_points_expiration_export_create_request_body Specify the data filters, types of data to return and order in which the results should be returned. + # @return [LoyaltiesPointsExpirationExportCreateResponseBody] + def create_points_expiration_export(campaign_id, opts = {}) + data, _status_code, _headers = create_points_expiration_export_with_http_info(campaign_id, opts) + data + end + + # Create Points Expiration Export + # Schedule the generation of a points expiration CSV file for a particular campaign. + # @param campaign_id [String] Unique campaign ID or name. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesPointsExpirationExportCreateRequestBody] :loyalties_points_expiration_export_create_request_body Specify the data filters, types of data to return and order in which the results should be returned. + # @return [Array<(LoyaltiesPointsExpirationExportCreateResponseBody, Integer, Hash)>] LoyaltiesPointsExpirationExportCreateResponseBody data, response status code and response headers + private def create_points_expiration_export_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.create_points_expiration_export ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/points-expiration/export'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_points_expiration_export_create_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesPointsExpirationExportCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.create_points_expiration_export", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#create_points_expiration_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Reward Assignment + # Add rewards to a loyalty campaign. + # @param campaign_id [String] Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [Array] :loyalties_rewards_create_assignment_item_request_body Define the cost of the rewards in loyalty points. + # @return [LoyaltiesRewardsCreateAssignmentResponseBody] + def create_reward_assignment1(campaign_id, opts = {}) + data, _status_code, _headers = create_reward_assignment1_with_http_info(campaign_id, opts) + data + end + + # Create Reward Assignment + # Add rewards to a loyalty campaign. + # @param campaign_id [String] Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [Array] :loyalties_rewards_create_assignment_item_request_body Define the cost of the rewards in loyalty points. + # @return [Array<(LoyaltiesRewardsCreateAssignmentResponseBody, Integer, Hash)>] LoyaltiesRewardsCreateAssignmentResponseBody data, response status code and response headers + private def create_reward_assignment1_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.create_reward_assignment1 ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/rewards'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_rewards_create_assignment_item_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesRewardsCreateAssignmentResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.create_reward_assignment1", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#create_reward_assignment1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete Earning Rule # This method deletes an earning rule for a specific loyalty campaign. # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. @@ -110,14 +434,6 @@ def delete_earning_rule(campaign_id, earning_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.delete_earning_rule ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.delete_earning_rule" - end - # verify the required parameter 'earning_rule_id' is set - if @api_client.config.client_side_validation && earning_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'earning_rule_id' when calling LoyaltiesApi.delete_earning_rule" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'earningRuleId' + '}', CGI.escape(earning_rule_id.to_s)) @@ -157,10 +473,10 @@ def delete_earning_rule(campaign_id, earning_rule_id, opts = {}) end # Delete Loyalty Campaign - # This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. + # Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name. + # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. # @return [LoyaltiesDeleteResponseBody] def delete_loyalty_program(campaign_id, opts = {}) data, _status_code, _headers = delete_loyalty_program_with_http_info(campaign_id, opts) @@ -168,19 +484,15 @@ def delete_loyalty_program(campaign_id, opts = {}) end # Delete Loyalty Campaign - # This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. + # Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name. + # @option opts [Boolean] :force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. # @return [Array<(LoyaltiesDeleteResponseBody, Integer, Hash)>] LoyaltiesDeleteResponseBody data, response status code and response headers private def delete_loyalty_program_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.delete_loyalty_program ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.delete_loyalty_program" - end # resource path local_var_path = '/v1/loyalties/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -243,14 +555,6 @@ def delete_reward_assignment1(campaign_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.delete_reward_assignment1 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.delete_reward_assignment1" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling LoyaltiesApi.delete_reward_assignment1" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/rewards/{assignmentId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -310,14 +614,6 @@ def disable_earning_rule(campaign_id, earning_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.disable_earning_rule ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.disable_earning_rule" - end - # verify the required parameter 'earning_rule_id' is set - if @api_client.config.client_side_validation && earning_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'earning_rule_id' when calling LoyaltiesApi.disable_earning_rule" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'earningRuleId' + '}', CGI.escape(earning_rule_id.to_s)) @@ -379,14 +675,6 @@ def enable_earning_rule(campaign_id, earning_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.enable_earning_rule ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.enable_earning_rule" - end - # verify the required parameter 'earning_rule_id' is set - if @api_client.config.client_side_validation && earning_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'earning_rule_id' when calling LoyaltiesApi.enable_earning_rule" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'earningRuleId' + '}', CGI.escape(earning_rule_id.to_s)) @@ -448,10 +736,6 @@ def export_loyalty_card_transactions(member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.export_loyalty_card_transactions ...' end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.export_loyalty_card_transactions" - end # resource path local_var_path = '/v1/loyalties/members/{memberId}/transactions/export'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -520,14 +804,6 @@ def export_loyalty_card_transactions1(campaign_id, member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.export_loyalty_card_transactions1 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.export_loyalty_card_transactions1" - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.export_loyalty_card_transactions1" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/transactions/export'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -594,14 +870,6 @@ def get_earning_rule(campaign_id, earning_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_earning_rule ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.get_earning_rule" - end - # verify the required parameter 'earning_rule_id' is set - if @api_client.config.client_side_validation && earning_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'earning_rule_id' when calling LoyaltiesApi.get_earning_rule" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'earningRuleId' + '}', CGI.escape(earning_rule_id.to_s)) @@ -642,8 +910,67 @@ def get_earning_rule(campaign_id, earning_rule_id, opts = {}) return data, status_code, headers end - # Get Loyalty Tier - # Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + # Get Loyalty Campaign + # Retrieve a specific loyalty campaign. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @return [LoyaltiesGetCampaignResponseBody] + def get_loyalty_program(campaign_id, opts = {}) + data, _status_code, _headers = get_loyalty_program_with_http_info(campaign_id, opts) + data + end + + # Get Loyalty Campaign + # Retrieve a specific loyalty campaign. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @return [Array<(LoyaltiesGetCampaignResponseBody, Integer, Hash)>] LoyaltiesGetCampaignResponseBody data, response status code and response headers + private def get_loyalty_program_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_loyalty_program ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesGetCampaignResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.get_loyalty_program", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#get_loyalty_program\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Loyalty Tier + # Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. # @param campaign_id [String] Unique loyalty campaign ID or name. # @param loyalty_tier_id [String] Unique loyalty tier ID. # @param [Hash] opts the optional parameters @@ -663,14 +990,6 @@ def get_loyalty_tier(campaign_id, loyalty_tier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_loyalty_tier ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.get_loyalty_tier" - end - # verify the required parameter 'loyalty_tier_id' is set - if @api_client.config.client_side_validation && loyalty_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'loyalty_tier_id' when calling LoyaltiesApi.get_loyalty_tier" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'loyaltyTierId' + '}', CGI.escape(loyalty_tier_id.to_s)) @@ -711,6 +1030,126 @@ def get_loyalty_tier(campaign_id, loyalty_tier_id, opts = {}) return data, status_code, headers end + # Get Member + # Retrieve loyalty card with the given member ID (i.e. voucher code). 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + # @param member_id [String] Unique loyalty card code assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @return [LoyaltiesMembersGetResponseBody] + def get_member(member_id, opts = {}) + data, _status_code, _headers = get_member_with_http_info(member_id, opts) + data + end + + # Get Member + # Retrieve loyalty card with the given member ID (i.e. voucher code). 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + # @param member_id [String] Unique loyalty card code assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @return [Array<(LoyaltiesMembersGetResponseBody, Integer, Hash)>] LoyaltiesMembersGetResponseBody data, response status code and response headers + private def get_member_with_http_info(member_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_member ...' + end + # resource path + local_var_path = '/v1/loyalties/members/{memberId}'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMembersGetResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.get_member", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#get_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Member + # Retrieves the loyalty card with the given member ID (i.e. voucher code). + # @param campaign_id [String] Unique campaign ID. + # @param member_id [String] Unique code that identifies the loyalty card. + # @param [Hash] opts the optional parameters + # @return [LoyaltiesMembersGetResponseBody] + def get_member1(campaign_id, member_id, opts = {}) + data, _status_code, _headers = get_member1_with_http_info(campaign_id, member_id, opts) + data + end + + # Get Member + # Retrieves the loyalty card with the given member ID (i.e. voucher code). + # @param campaign_id [String] Unique campaign ID. + # @param member_id [String] Unique code that identifies the loyalty card. + # @param [Hash] opts the optional parameters + # @return [Array<(LoyaltiesMembersGetResponseBody, Integer, Hash)>] LoyaltiesMembersGetResponseBody data, response status code and response headers + private def get_member1_with_http_info(campaign_id, member_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_member1 ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMembersGetResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.get_member1", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#get_member1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get Reward Assignment # Retrieve specific reward assignment. # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. @@ -732,14 +1171,6 @@ def get_reward_assignment1(campaign_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_reward_assignment1 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.get_reward_assignment1" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling LoyaltiesApi.get_reward_assignment1" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -801,14 +1232,6 @@ def get_reward_assignment2(campaign_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_reward_assignment2 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.get_reward_assignment2" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling LoyaltiesApi.get_reward_assignment2" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/rewards/{assignmentId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -870,14 +1293,6 @@ def get_reward_details(campaign_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.get_reward_details ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.get_reward_details" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling LoyaltiesApi.get_reward_details" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -918,12 +1333,79 @@ def get_reward_details(campaign_id, assignment_id, opts = {}) return data, status_code, headers end + # List Earning Rules + # Returns a list of all earning rules within a given campaign. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListEarningRules] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [LoyaltiesEarningRulesListResponseBody] + def list_earning_rules(campaign_id, opts = {}) + data, _status_code, _headers = list_earning_rules_with_http_info(campaign_id, opts) + data + end + + # List Earning Rules + # Returns a list of all earning rules within a given campaign. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListEarningRules] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [Array<(LoyaltiesEarningRulesListResponseBody, Integer, Hash)>] LoyaltiesEarningRulesListResponseBody data, response status code and response headers + private def list_earning_rules_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_earning_rules ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/earning-rules'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesEarningRulesListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_earning_rules", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_earning_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List Loyalty Card Transactions # Retrieve transaction data related to point movements for a specific loyalty card. # @param member_id [String] A unique code identifying the loyalty card that you are looking to retrieve transaction data for. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @return [LoyaltiesMembersTransactionsListResponseBody] def list_loyalty_card_transactions(member_id, opts = {}) data, _status_code, _headers = list_loyalty_card_transactions_with_http_info(member_id, opts) @@ -934,36 +1416,18 @@ def list_loyalty_card_transactions(member_id, opts = {}) # Retrieve transaction data related to point movements for a specific loyalty card. # @param member_id [String] A unique code identifying the loyalty card that you are looking to retrieve transaction data for. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @return [Array<(LoyaltiesMembersTransactionsListResponseBody, Integer, Hash)>] LoyaltiesMembersTransactionsListResponseBody data, response status code and response headers private def list_loyalty_card_transactions_with_http_info(member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_card_transactions ...' end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.list_loyalty_card_transactions" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_card_transactions, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_card_transactions, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LoyaltiesApi.list_loyalty_card_transactions, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/loyalties/members/{memberId}/transactions'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? - query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1004,8 +1468,8 @@ def list_loyalty_card_transactions(member_id, opts = {}) # @param campaign_id [String] A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. # @param member_id [String] A unique code identifying the loyalty card that you are looking to retrieve transaction data for. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @return [LoyaltiesMembersTransactionsListResponseBody] def list_loyalty_card_transactions1(campaign_id, member_id, opts = {}) data, _status_code, _headers = list_loyalty_card_transactions1_with_http_info(campaign_id, member_id, opts) @@ -1017,33 +1481,13 @@ def list_loyalty_card_transactions1(campaign_id, member_id, opts = {}) # @param campaign_id [String] A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. # @param member_id [String] A unique code identifying the loyalty card that you are looking to retrieve transaction data for. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @return [Array<(LoyaltiesMembersTransactionsListResponseBody, Integer, Hash)>] LoyaltiesMembersTransactionsListResponseBody data, response status code and response headers private def list_loyalty_card_transactions1_with_http_info(campaign_id, member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_card_transactions1 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.list_loyalty_card_transactions1" - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.list_loyalty_card_transactions1" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_card_transactions1, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_card_transactions1, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LoyaltiesApi.list_loyalty_card_transactions1, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/transactions'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -1086,58 +1530,37 @@ def list_loyalty_card_transactions1(campaign_id, member_id, opts = {}) return data, status_code, headers end - # List Loyalty Tier Earning Rules - # Retrieve available earning rules for a given tier and the calculation method for earning points. - # @param campaign_id [String] Unique campaign ID or name. - # @param loyalty_tier_id [String] Unique loyalty tier ID. + # List Loyalty Campaigns + # Returns a list of your loyalty campaigns. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. - # @return [LoyaltiesTiersEarningRulesListResponseBody] - def list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts = {}) - data, _status_code, _headers = list_loyalty_tier_earning_rules_with_http_info(campaign_id, loyalty_tier_id, opts) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListCampaigns] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [LoyaltiesListCampaignsResponseBody] + def list_loyalty_programs(opts = {}) + data, _status_code, _headers = list_loyalty_programs_with_http_info(opts) data end - # List Loyalty Tier Earning Rules - # Retrieve available earning rules for a given tier and the calculation method for earning points. - # @param campaign_id [String] Unique campaign ID or name. - # @param loyalty_tier_id [String] Unique loyalty tier ID. + # List Loyalty Campaigns + # Returns a list of your loyalty campaigns. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. - # @return [Array<(LoyaltiesTiersEarningRulesListResponseBody, Integer, Hash)>] LoyaltiesTiersEarningRulesListResponseBody data, response status code and response headers - private def list_loyalty_tier_earning_rules_with_http_info(campaign_id, loyalty_tier_id, opts = {}) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListCampaigns] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [Array<(LoyaltiesListCampaignsResponseBody, Integer, Hash)>] LoyaltiesListCampaignsResponseBody data, response status code and response headers + private def list_loyalty_programs_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_tier_earning_rules ...' - end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.list_loyalty_tier_earning_rules" - end - # verify the required parameter 'loyalty_tier_id' is set - if @api_client.config.client_side_validation && loyalty_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'loyalty_tier_id' when calling LoyaltiesApi.list_loyalty_tier_earning_rules" + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_programs ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_tier_earning_rules, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_tier_earning_rules, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LoyaltiesApi.list_loyalty_tier_earning_rules, must be smaller than or equal to 100.' - end - # resource path - local_var_path = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'loyaltyTierId' + '}', CGI.escape(loyalty_tier_id.to_s)) + local_var_path = '/v1/loyalties' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1151,13 +1574,13 @@ def list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'LoyaltiesTiersEarningRulesListResponseBody' + return_type = opts[:debug_return_type] || 'LoyaltiesListCampaignsResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( - :operation => :"LoyaltiesApi.list_loyalty_tier_earning_rules", + :operation => :"LoyaltiesApi.list_loyalty_programs", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -1168,39 +1591,98 @@ def list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: LoyaltiesApi#list_loyalty_tier_earning_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: LoyaltiesApi#list_loyalty_programs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # List Loyalty Tier Rewards - # Get available rewards for a given tier. + # List Loyalty Tier Earning Rules + # Retrieve available earning rules for a given tier and the calculation method for earning points. # @param campaign_id [String] Unique campaign ID or name. # @param loyalty_tier_id [String] Unique loyalty tier ID. # @param [Hash] opts the optional parameters - # @return [LoyaltiesTiersRewardsListResponseBody] - def list_loyalty_tier_rewards(campaign_id, loyalty_tier_id, opts = {}) - data, _status_code, _headers = list_loyalty_tier_rewards_with_http_info(campaign_id, loyalty_tier_id, opts) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @return [LoyaltiesTiersEarningRulesListResponseBody] + def list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts = {}) + data, _status_code, _headers = list_loyalty_tier_earning_rules_with_http_info(campaign_id, loyalty_tier_id, opts) data end - # List Loyalty Tier Rewards - # Get available rewards for a given tier. + # List Loyalty Tier Earning Rules + # Retrieve available earning rules for a given tier and the calculation method for earning points. # @param campaign_id [String] Unique campaign ID or name. # @param loyalty_tier_id [String] Unique loyalty tier ID. # @param [Hash] opts the optional parameters - # @return [Array<(LoyaltiesTiersRewardsListResponseBody, Integer, Hash)>] LoyaltiesTiersRewardsListResponseBody data, response status code and response headers - private def list_loyalty_tier_rewards_with_http_info(campaign_id, loyalty_tier_id, opts = {}) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @return [Array<(LoyaltiesTiersEarningRulesListResponseBody, Integer, Hash)>] LoyaltiesTiersEarningRulesListResponseBody data, response status code and response headers + private def list_loyalty_tier_earning_rules_with_http_info(campaign_id, loyalty_tier_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_tier_rewards ...' - end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.list_loyalty_tier_rewards" + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_tier_earning_rules ...' end - # verify the required parameter 'loyalty_tier_id' is set - if @api_client.config.client_side_validation && loyalty_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'loyalty_tier_id' when calling LoyaltiesApi.list_loyalty_tier_rewards" + # resource path + local_var_path = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'loyaltyTierId' + '}', CGI.escape(loyalty_tier_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesTiersEarningRulesListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_loyalty_tier_earning_rules", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_loyalty_tier_earning_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Loyalty Tier Rewards + # Get available rewards for a given tier. + # @param campaign_id [String] Unique campaign ID or name. + # @param loyalty_tier_id [String] Unique loyalty tier ID. + # @param [Hash] opts the optional parameters + # @return [LoyaltiesTiersRewardsListResponseBody] + def list_loyalty_tier_rewards(campaign_id, loyalty_tier_id, opts = {}) + data, _status_code, _headers = list_loyalty_tier_rewards_with_http_info(campaign_id, loyalty_tier_id, opts) + data + end + + # List Loyalty Tier Rewards + # Get available rewards for a given tier. + # @param campaign_id [String] Unique campaign ID or name. + # @param loyalty_tier_id [String] Unique loyalty tier ID. + # @param [Hash] opts the optional parameters + # @return [Array<(LoyaltiesTiersRewardsListResponseBody, Integer, Hash)>] LoyaltiesTiersRewardsListResponseBody data, response status code and response headers + private def list_loyalty_tier_rewards_with_http_info(campaign_id, loyalty_tier_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_tier_rewards ...' end # resource path local_var_path = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'loyaltyTierId' + '}', CGI.escape(loyalty_tier_id.to_s)) @@ -1246,7 +1728,7 @@ def list_loyalty_tier_rewards(campaign_id, loyalty_tier_id, opts = {}) # Retrieve a list of loyalty tiers which were added to the loyalty program. # @param campaign_id [String] Unique loyalty campaign ID or name. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [ParameterOrderListLoyaltyTiers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [LoyaltiesTiersListResponseBody] def list_loyalty_tiers(campaign_id, opts = {}) @@ -1258,32 +1740,362 @@ def list_loyalty_tiers(campaign_id, opts = {}) # Retrieve a list of loyalty tiers which were added to the loyalty program. # @param campaign_id [String] Unique loyalty campaign ID or name. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [ParameterOrderListLoyaltyTiers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [Array<(LoyaltiesTiersListResponseBody, Integer, Hash)>] LoyaltiesTiersListResponseBody data, response status code and response headers private def list_loyalty_tiers_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_loyalty_tiers ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.list_loyalty_tiers" + # resource path + local_var_path = '/v1/loyalties/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesTiersListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_loyalty_tiers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_loyalty_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Member Activity + # 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + # @param member_id [String] Unique loyalty card assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @return [LoyaltiesMemberActivityListResponseBody] + def list_member_activity(member_id, opts = {}) + data, _status_code, _headers = list_member_activity_with_http_info(member_id, opts) + data + end + + # List Member Activity + # 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + # @param member_id [String] Unique loyalty card assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @return [Array<(LoyaltiesMemberActivityListResponseBody, Integer, Hash)>] LoyaltiesMemberActivityListResponseBody data, response status code and response headers + private def list_member_activity_with_http_info(member_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_member_activity ...' + end + # resource path + local_var_path = '/v1/loyalties/members/{memberId}/activity'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMemberActivityListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_member_activity", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_member_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Member Activity + # Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + # @param campaign_id [String] Unique campaign ID. + # @param member_id [String] A code that identifies the loyalty card. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @return [LoyaltiesMemberActivityListResponseBody] + def list_member_activity1(campaign_id, member_id, opts = {}) + data, _status_code, _headers = list_member_activity1_with_http_info(campaign_id, member_id, opts) + data + end + + # List Member Activity + # Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + # @param campaign_id [String] Unique campaign ID. + # @param member_id [String] A code that identifies the loyalty card. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. + # @return [Array<(LoyaltiesMemberActivityListResponseBody, Integer, Hash)>] LoyaltiesMemberActivityListResponseBody data, response status code and response headers + private def list_member_activity1_with_http_info(campaign_id, member_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_member_activity1 ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/activity'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMemberActivityListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_member_activity1", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_member_activity1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Member's Loyalty Tiers + # Retrieve member tiers using the loyalty card ID. + # @param member_id [String] Unique loyalty card assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @return [LoyaltiesMembersTiersListResponseBody] + def list_member_loyalty_tier(member_id, opts = {}) + data, _status_code, _headers = list_member_loyalty_tier_with_http_info(member_id, opts) + data + end + + # List Member's Loyalty Tiers + # Retrieve member tiers using the loyalty card ID. + # @param member_id [String] Unique loyalty card assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @return [Array<(LoyaltiesMembersTiersListResponseBody, Integer, Hash)>] LoyaltiesMembersTiersListResponseBody data, response status code and response headers + private def list_member_loyalty_tier_with_http_info(member_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_member_loyalty_tier ...' + end + # resource path + local_var_path = '/v1/loyalties/members/{memberId}/tiers'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMembersTiersListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_member_loyalty_tier", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_member_loyalty_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Member Rewards + # Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + # @param member_id [String] Unique loyalty card assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :affordable_only Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + # @return [LoyaltiesMembersRewardsListResponseBody] + def list_member_rewards(member_id, opts = {}) + data, _status_code, _headers = list_member_rewards_with_http_info(member_id, opts) + data + end + + # List Member Rewards + # Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + # @param member_id [String] Unique loyalty card assigned to a particular customer. + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :affordable_only Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + # @return [Array<(LoyaltiesMembersRewardsListResponseBody, Integer, Hash)>] LoyaltiesMembersRewardsListResponseBody data, response status code and response headers + private def list_member_rewards_with_http_info(member_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_member_rewards ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_tiers, must be smaller than or equal to 100.' + # resource path + local_var_path = '/v1/loyalties/members/{memberId}/rewards'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'affordable_only'] = opts[:'affordable_only'] if !opts[:'affordable_only'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesMembersRewardsListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.list_member_rewards", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#list_member_rewards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end + return data, status_code, headers + end + + # List Members + # Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + # @param campaign_id [String] Unique campaign ID of the loyalty program. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + # @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterOrderVouchers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :code + # @option opts [Array] :ids + # @return [LoyaltiesListMembersResponseBody] + def list_members(campaign_id, opts = {}) + data, _status_code, _headers = list_members_with_http_info(campaign_id, opts) + data + end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_loyalty_tiers, must be greater than or equal to 1.' + # List Members + # Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + # @param campaign_id [String] Unique campaign ID of the loyalty program. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + # @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterOrderVouchers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :code + # @option opts [Array] :ids + # @return [Array<(LoyaltiesListMembersResponseBody, Integer, Hash)>] LoyaltiesListMembersResponseBody data, response status code and response headers + private def list_members_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_members ...' end - # resource path - local_var_path = '/v1/loyalties/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + local_var_path = '/v1/loyalties/{campaignId}/members'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'customer'] = opts[:'customer'] if !opts[:'customer'].nil? + query_params[:'created_at'] = opts[:'created_at'] if !opts[:'created_at'].nil? + query_params[:'updated_at'] = opts[:'updated_at'] if !opts[:'updated_at'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil? + query_params[:'ids'] = @api_client.build_collection_param(opts[:'ids'], :multi) if !opts[:'ids'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1297,13 +2109,13 @@ def list_loyalty_tiers(campaign_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'LoyaltiesTiersListResponseBody' + return_type = opts[:debug_return_type] || 'LoyaltiesListMembersResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( - :operation => :"LoyaltiesApi.list_loyalty_tiers", + :operation => :"LoyaltiesApi.list_members", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -1314,39 +2126,43 @@ def list_loyalty_tiers(campaign_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: LoyaltiesApi#list_loyalty_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: LoyaltiesApi#list_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # List Member's Loyalty Tiers - # Retrieve member tiers using the loyalty card ID. - # @param member_id [String] Unique loyalty card assigned to a particular customer. + # Get Points Expiration + # Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param member_id [String] Loyalty card code. # @param [Hash] opts the optional parameters - # @return [LoyaltiesMembersTiersListResponseBody] - def list_member_loyalty_tier(member_id, opts = {}) - data, _status_code, _headers = list_member_loyalty_tier_with_http_info(member_id, opts) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @return [LoyaltiesMembersPointsExpirationListResponseBody] + def list_points_expiration(campaign_id, member_id, opts = {}) + data, _status_code, _headers = list_points_expiration_with_http_info(campaign_id, member_id, opts) data end - # List Member's Loyalty Tiers - # Retrieve member tiers using the loyalty card ID. - # @param member_id [String] Unique loyalty card assigned to a particular customer. + # Get Points Expiration + # Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param member_id [String] Loyalty card code. # @param [Hash] opts the optional parameters - # @return [Array<(LoyaltiesMembersTiersListResponseBody, Integer, Hash)>] LoyaltiesMembersTiersListResponseBody data, response status code and response headers - private def list_member_loyalty_tier_with_http_info(member_id, opts = {}) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @return [Array<(LoyaltiesMembersPointsExpirationListResponseBody, Integer, Hash)>] LoyaltiesMembersPointsExpirationListResponseBody data, response status code and response headers + private def list_points_expiration_with_http_info(campaign_id, member_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_member_loyalty_tier ...' - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.list_member_loyalty_tier" + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_points_expiration ...' end # resource path - local_var_path = '/v1/loyalties/members/{memberId}/tiers'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/points-expiration'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) # query parameters query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1360,13 +2176,13 @@ def list_member_loyalty_tier(member_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'LoyaltiesMembersTiersListResponseBody' + return_type = opts[:debug_return_type] || 'LoyaltiesMembersPointsExpirationListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( - :operation => :"LoyaltiesApi.list_member_loyalty_tier", + :operation => :"LoyaltiesApi.list_points_expiration", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -1377,42 +2193,44 @@ def list_member_loyalty_tier(member_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: LoyaltiesApi#list_member_loyalty_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: LoyaltiesApi#list_points_expiration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # List Member Rewards - # Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. - # @param member_id [String] Unique loyalty card assigned to a particular customer. + # List Reward Assignments + # Returns reward assignments from a given loyalty campaign. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :affordable_only Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. - # @return [LoyaltiesMembersRewardsListResponseBody] - def list_member_rewards(member_id, opts = {}) - data, _status_code, _headers = list_member_rewards_with_http_info(member_id, opts) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :assignment_id A unique reward assignment ID. + # @return [LoyaltiesRewardAssignmentsListResponseBody] + def list_reward_assignments1(campaign_id, opts = {}) + data, _status_code, _headers = list_reward_assignments1_with_http_info(campaign_id, opts) data end - # List Member Rewards - # Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. - # @param member_id [String] Unique loyalty card assigned to a particular customer. + # List Reward Assignments + # Returns reward assignments from a given loyalty campaign. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :affordable_only Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. - # @return [Array<(LoyaltiesMembersRewardsListResponseBody, Integer, Hash)>] LoyaltiesMembersRewardsListResponseBody data, response status code and response headers - private def list_member_rewards_with_http_info(member_id, opts = {}) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :assignment_id A unique reward assignment ID. + # @return [Array<(LoyaltiesRewardAssignmentsListResponseBody, Integer, Hash)>] LoyaltiesRewardAssignmentsListResponseBody data, response status code and response headers + private def list_reward_assignments1_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_member_rewards ...' - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.list_member_rewards" + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_reward_assignments1 ...' end # resource path - local_var_path = '/v1/loyalties/members/{memberId}/rewards'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + local_var_path = '/v1/loyalties/{campaignId}/reward-assignments'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} - query_params[:'affordable_only'] = opts[:'affordable_only'] if !opts[:'affordable_only'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'assignmentId'] = opts[:'assignment_id'] if !opts[:'assignment_id'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1426,13 +2244,13 @@ def list_member_rewards(member_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'LoyaltiesMembersRewardsListResponseBody' + return_type = opts[:debug_return_type] || 'LoyaltiesRewardAssignmentsListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( - :operation => :"LoyaltiesApi.list_member_rewards", + :operation => :"LoyaltiesApi.list_reward_assignments1", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -1443,63 +2261,44 @@ def list_member_rewards(member_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: LoyaltiesApi#list_member_rewards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: LoyaltiesApi#list_reward_assignments1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Get Points Expiration - # Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. - # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. - # @param member_id [String] Loyalty card code. + # List Reward Assignments + # Returns active rewards from a given loyalty campaign. + # @param campaign_id [String] Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. - # @return [LoyaltiesMembersPointsExpirationListResponseBody] - def list_points_expiration(campaign_id, member_id, opts = {}) - data, _status_code, _headers = list_points_expiration_with_http_info(campaign_id, member_id, opts) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :assignment_id A unique reward assignment ID. + # @return [LoyaltiesRewardsListAssignmentsResponseBody] + def list_reward_assignments2(campaign_id, opts = {}) + data, _status_code, _headers = list_reward_assignments2_with_http_info(campaign_id, opts) data end - # Get Points Expiration - # Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. - # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. - # @param member_id [String] Loyalty card code. + # List Reward Assignments + # Returns active rewards from a given loyalty campaign. + # @param campaign_id [String] Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. - # @return [Array<(LoyaltiesMembersPointsExpirationListResponseBody, Integer, Hash)>] LoyaltiesMembersPointsExpirationListResponseBody data, response status code and response headers - private def list_points_expiration_with_http_info(campaign_id, member_id, opts = {}) + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :assignment_id A unique reward assignment ID. + # @return [Array<(LoyaltiesRewardsListAssignmentsResponseBody, Integer, Hash)>] LoyaltiesRewardsListAssignmentsResponseBody data, response status code and response headers + private def list_reward_assignments2_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_points_expiration ...' - end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.list_points_expiration" - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.list_points_expiration" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_points_expiration, must be smaller than or equal to 100.' + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.list_reward_assignments2 ...' end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LoyaltiesApi.list_points_expiration, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LoyaltiesApi.list_points_expiration, must be smaller than or equal to 100.' - end - # resource path - local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/points-expiration'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) + local_var_path = '/v1/loyalties/{campaignId}/rewards'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'assignment_id'] = opts[:'assignment_id'] if !opts[:'assignment_id'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1513,13 +2312,13 @@ def list_points_expiration(campaign_id, member_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'LoyaltiesMembersPointsExpirationListResponseBody' + return_type = opts[:debug_return_type] || 'LoyaltiesRewardsListAssignmentsResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( - :operation => :"LoyaltiesApi.list_points_expiration", + :operation => :"LoyaltiesApi.list_reward_assignments2", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -1530,7 +2329,7 @@ def list_points_expiration(campaign_id, member_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: LoyaltiesApi#list_points_expiration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: LoyaltiesApi#list_reward_assignments2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -1556,10 +2355,6 @@ def redeem_reward(member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.redeem_reward ...' end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.redeem_reward" - end # resource path local_var_path = '/v1/loyalties/members/{memberId}/redemption'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -1628,14 +2423,6 @@ def redeem_reward1(campaign_id, member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.redeem_reward1 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.redeem_reward1" - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.redeem_reward1" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/redemption'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -1704,14 +2491,6 @@ def transfer_points(campaign_id, member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.transfer_points ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.transfer_points" - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.transfer_points" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/transfers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -1757,8 +2536,76 @@ def transfer_points(campaign_id, member_id, opts = {}) return data, status_code, headers end + # Update Earning Rule + # Update an earning rule definition. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param earning_rule_id [String] A unique earning rule ID. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesEarningRulesUpdateRequestBody] :loyalties_earning_rules_update_request_body Specify the parameters that you would like to update for the given earning rule. + # @return [LoyaltiesEarningRulesUpdateResponseBody] + def update_earning_rule(campaign_id, earning_rule_id, opts = {}) + data, _status_code, _headers = update_earning_rule_with_http_info(campaign_id, earning_rule_id, opts) + data + end + + # Update Earning Rule + # Update an earning rule definition. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param earning_rule_id [String] A unique earning rule ID. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesEarningRulesUpdateRequestBody] :loyalties_earning_rules_update_request_body Specify the parameters that you would like to update for the given earning rule. + # @return [Array<(LoyaltiesEarningRulesUpdateResponseBody, Integer, Hash)>] LoyaltiesEarningRulesUpdateResponseBody data, response status code and response headers + private def update_earning_rule_with_http_info(campaign_id, earning_rule_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.update_earning_rule ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'earningRuleId' + '}', CGI.escape(earning_rule_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_earning_rules_update_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesEarningRulesUpdateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.update_earning_rule", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#update_earning_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Add or Remove Loyalty Card Balance - # This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + # This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. # @param member_id [String] Unique loyalty card assigned to a particular customer. # @param [Hash] opts the optional parameters # @option opts [LoyaltiesMembersBalanceUpdateRequestBody] :loyalties_members_balance_update_request_body Specify the point adjustment along with the expiration mechanism. @@ -1769,7 +2616,7 @@ def update_loyalty_card_balance(member_id, opts = {}) end # Add or Remove Loyalty Card Balance - # This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + # This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. # @param member_id [String] Unique loyalty card assigned to a particular customer. # @param [Hash] opts the optional parameters # @option opts [LoyaltiesMembersBalanceUpdateRequestBody] :loyalties_members_balance_update_request_body Specify the point adjustment along with the expiration mechanism. @@ -1778,10 +2625,6 @@ def update_loyalty_card_balance(member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.update_loyalty_card_balance ...' end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.update_loyalty_card_balance" - end # resource path local_var_path = '/v1/loyalties/members/{memberId}/balance'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -1828,7 +2671,7 @@ def update_loyalty_card_balance(member_id, opts = {}) end # Add or Remove Loyalty Card Balance - # This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. + # This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. # @param campaign_id [String] Unique campaign ID. # @param member_id [String] A code that identifies the loyalty card. # @param [Hash] opts the optional parameters @@ -1840,7 +2683,7 @@ def update_loyalty_card_balance1(campaign_id, member_id, opts = {}) end # Add or Remove Loyalty Card Balance - # This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. + # This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. # @param campaign_id [String] Unique campaign ID. # @param member_id [String] A code that identifies the loyalty card. # @param [Hash] opts the optional parameters @@ -1850,14 +2693,6 @@ def update_loyalty_card_balance1(campaign_id, member_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoyaltiesApi.update_loyalty_card_balance1 ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling LoyaltiesApi.update_loyalty_card_balance1" - end - # verify the required parameter 'member_id' is set - if @api_client.config.client_side_validation && member_id.nil? - fail ArgumentError, "Missing the required parameter 'member_id' when calling LoyaltiesApi.update_loyalty_card_balance1" - end # resource path local_var_path = '/v1/loyalties/{campaignId}/members/{memberId}/balance'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)) @@ -1902,5 +2737,139 @@ def update_loyalty_card_balance1(campaign_id, member_id, opts = {}) end return data, status_code, headers end + + # Update Loyalty Campaign + # Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesUpdateCampaignRequestBody] :loyalties_update_campaign_request_body Specify the new values for the parameters that you would like to update for the given loyalty campaign. + # @return [LoyaltiesUpdateCampaignResponseBody] + def update_loyalty_program(campaign_id, opts = {}) + data, _status_code, _headers = update_loyalty_program_with_http_info(campaign_id, opts) + data + end + + # Update Loyalty Campaign + # Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesUpdateCampaignRequestBody] :loyalties_update_campaign_request_body Specify the new values for the parameters that you would like to update for the given loyalty campaign. + # @return [Array<(LoyaltiesUpdateCampaignResponseBody, Integer, Hash)>] LoyaltiesUpdateCampaignResponseBody data, response status code and response headers + private def update_loyalty_program_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.update_loyalty_program ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_update_campaign_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesUpdateCampaignResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.update_loyalty_program", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#update_loyalty_program\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Reward Assignment + # Updates rewards parameters, i.e. the points cost for the specific reward. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param assignment_id [String] A unique reward assignment ID. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesRewardsUpdateAssignmentRequestBody] :loyalties_rewards_update_assignment_request_body Update the points cost for the reward assignment. + # @return [LoyaltiesRewardsUpdateAssignmentResponseBody] + def update_reward_assignment1(campaign_id, assignment_id, opts = {}) + data, _status_code, _headers = update_reward_assignment1_with_http_info(campaign_id, assignment_id, opts) + data + end + + # Update Reward Assignment + # Updates rewards parameters, i.e. the points cost for the specific reward. + # @param campaign_id [String] The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + # @param assignment_id [String] A unique reward assignment ID. + # @param [Hash] opts the optional parameters + # @option opts [LoyaltiesRewardsUpdateAssignmentRequestBody] :loyalties_rewards_update_assignment_request_body Update the points cost for the reward assignment. + # @return [Array<(LoyaltiesRewardsUpdateAssignmentResponseBody, Integer, Hash)>] LoyaltiesRewardsUpdateAssignmentResponseBody data, response status code and response headers + private def update_reward_assignment1_with_http_info(campaign_id, assignment_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoyaltiesApi.update_reward_assignment1 ...' + end + # resource path + local_var_path = '/v1/loyalties/{campaignId}/rewards/{assignmentId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'loyalties_rewards_update_assignment_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'LoyaltiesRewardsUpdateAssignmentResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"LoyaltiesApi.update_reward_assignment1", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoyaltiesApi#update_reward_assignment1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/VoucherifySdk/api/orders_api.rb b/lib/VoucherifySdk/api/orders_api.rb index 815c4249..e57b50cc 100644 --- a/lib/VoucherifySdk/api/orders_api.rb +++ b/lib/VoucherifySdk/api/orders_api.rb @@ -166,10 +166,6 @@ def get_order(order_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersApi.get_order ...' end - # verify the required parameter 'order_id' is set - if @api_client.config.client_side_validation && order_id.nil? - fail ArgumentError, "Missing the required parameter 'order_id' when calling OrdersApi.get_order" - end # resource path local_var_path = '/v1/orders/{orderId}'.sub('{' + 'orderId' + '}', CGI.escape(order_id.to_s)) @@ -277,8 +273,8 @@ def import_orders(opts = {}) # List Orders # Returns a list of orders. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListOrders] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [OrdersListResponseBody] def list_orders(opts = {}) @@ -289,26 +285,14 @@ def list_orders(opts = {}) # List Orders # Returns a list of orders. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListOrders] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [Array<(OrdersListResponseBody, Integer, Hash)>] OrdersListResponseBody data, response status code and response headers private def list_orders_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersApi.list_orders ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrdersApi.list_orders, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrdersApi.list_orders, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling OrdersApi.list_orders, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/orders' @@ -373,10 +357,6 @@ def update_order(order_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersApi.update_order ...' end - # verify the required parameter 'order_id' is set - if @api_client.config.client_side_validation && order_id.nil? - fail ArgumentError, "Missing the required parameter 'order_id' when calling OrdersApi.update_order" - end # resource path local_var_path = '/v1/orders/{orderId}'.sub('{' + 'orderId' + '}', CGI.escape(order_id.to_s)) diff --git a/lib/VoucherifySdk/api/product_collections_api.rb b/lib/VoucherifySdk/api/product_collections_api.rb index cb0ba190..bcea7d91 100644 --- a/lib/VoucherifySdk/api/product_collections_api.rb +++ b/lib/VoucherifySdk/api/product_collections_api.rb @@ -102,10 +102,6 @@ def delete_product_collection(product_collection_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.delete_product_collection ...' end - # verify the required parameter 'product_collection_id' is set - if @api_client.config.client_side_validation && product_collection_id.nil? - fail ArgumentError, "Missing the required parameter 'product_collection_id' when calling ProductCollectionsApi.delete_product_collection" - end # resource path local_var_path = '/v1/product-collections/{productCollectionId}'.sub('{' + 'productCollectionId' + '}', CGI.escape(product_collection_id.to_s)) @@ -163,10 +159,6 @@ def get_product_collection(product_collection_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.get_product_collection ...' end - # verify the required parameter 'product_collection_id' is set - if @api_client.config.client_side_validation && product_collection_id.nil? - fail ArgumentError, "Missing the required parameter 'product_collection_id' when calling ProductCollectionsApi.get_product_collection" - end # resource path local_var_path = '/v1/product-collections/{productCollectionId}'.sub('{' + 'productCollectionId' + '}', CGI.escape(product_collection_id.to_s)) @@ -210,8 +202,8 @@ def get_product_collection(product_collection_id, opts = {}) # List Product Collections # This method returns a list of product collections. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [ProductCollectionsListResponseBody] def list_product_collections(opts = {}) @@ -222,26 +214,14 @@ def list_product_collections(opts = {}) # List Product Collections # This method returns a list of product collections. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [Array<(ProductCollectionsListResponseBody, Integer, Hash)>] ProductCollectionsListResponseBody data, response status code and response headers private def list_product_collections_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.list_product_collections ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductCollectionsApi.list_product_collections, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductCollectionsApi.list_product_collections, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ProductCollectionsApi.list_product_collections, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/product-collections' @@ -289,8 +269,8 @@ def list_product_collections(opts = {}) # Retrieves list of products from a product collection; works for both dynamic and static product collections. # @param product_collection_id [String] Unique product collection ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :starting_after Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. # @return [ProductCollectionsProductsListResponseBody] @@ -303,8 +283,8 @@ def list_products_in_collection(product_collection_id, opts = {}) # Retrieves list of products from a product collection; works for both dynamic and static product collections. # @param product_collection_id [String] Unique product collection ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :starting_after Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. # @return [Array<(ProductCollectionsProductsListResponseBody, Integer, Hash)>] ProductCollectionsProductsListResponseBody data, response status code and response headers @@ -312,22 +292,6 @@ def list_products_in_collection(product_collection_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.list_products_in_collection ...' end - # verify the required parameter 'product_collection_id' is set - if @api_client.config.client_side_validation && product_collection_id.nil? - fail ArgumentError, "Missing the required parameter 'product_collection_id' when calling ProductCollectionsApi.list_products_in_collection" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductCollectionsApi.list_products_in_collection, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductCollectionsApi.list_products_in_collection, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ProductCollectionsApi.list_products_in_collection, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/product-collections/{productCollectionId}/products'.sub('{' + 'productCollectionId' + '}', CGI.escape(product_collection_id.to_s)) diff --git a/lib/VoucherifySdk/api/products_api.rb b/lib/VoucherifySdk/api/products_api.rb index 6d3352b0..a990ebb8 100644 --- a/lib/VoucherifySdk/api/products_api.rb +++ b/lib/VoucherifySdk/api/products_api.rb @@ -104,10 +104,6 @@ def create_sku(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.create_sku ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.create_sku" - end # resource path local_var_path = '/v1/products/{productId}/skus'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)) @@ -154,10 +150,10 @@ def create_sku(product_id, opts = {}) end # Delete Product - # This method deletes a product. + # Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. # @param product_id [String] A Voucherify product ID or source ID. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same source_id. + # @option opts [Boolean] :force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. # @return [nil] def delete_product(product_id, opts = {}) delete_product_with_http_info(product_id, opts) @@ -165,19 +161,15 @@ def delete_product(product_id, opts = {}) end # Delete Product - # This method deletes a product. + # Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. # @param product_id [String] A Voucherify product ID or source ID. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same source_id. + # @option opts [Boolean] :force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers private def delete_product_with_http_info(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.delete_product ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.delete_product" - end # resource path local_var_path = '/v1/products/{productId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)) @@ -218,11 +210,11 @@ def delete_product(product_id, opts = {}) end # Delete SKU - # This method deletes a product SKU. + # Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. # @param product_id [String] A unique Voucherify product ID or product source ID. # @param sku_id [String] A Voucherify SKU ID or SKU source ID. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same source_id. + # @option opts [Boolean] :force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. # @return [nil] def delete_sku(product_id, sku_id, opts = {}) delete_sku_with_http_info(product_id, sku_id, opts) @@ -230,24 +222,16 @@ def delete_sku(product_id, sku_id, opts = {}) end # Delete SKU - # This method deletes a product SKU. + # Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. # @param product_id [String] A unique Voucherify product ID or product source ID. # @param sku_id [String] A Voucherify SKU ID or SKU source ID. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same source_id. + # @option opts [Boolean] :force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers private def delete_sku_with_http_info(product_id, sku_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.delete_sku ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.delete_sku" - end - # verify the required parameter 'sku_id' is set - if @api_client.config.client_side_validation && sku_id.nil? - fail ArgumentError, "Missing the required parameter 'sku_id' when calling ProductsApi.delete_sku" - end # resource path local_var_path = '/v1/products/{productId}/skus/{skuId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)).sub('{' + 'skuId' + '}', CGI.escape(sku_id.to_s)) @@ -306,10 +290,6 @@ def get_product(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.get_product ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_product" - end # resource path local_var_path = '/v1/products/{productId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)) @@ -369,10 +349,6 @@ def get_sku(sku_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.get_sku ...' end - # verify the required parameter 'sku_id' is set - if @api_client.config.client_side_validation && sku_id.nil? - fail ArgumentError, "Missing the required parameter 'sku_id' when calling ProductsApi.get_sku" - end # resource path local_var_path = '/v1/skus/{skuId}'.sub('{' + 'skuId' + '}', CGI.escape(sku_id.to_s)) @@ -415,27 +391,23 @@ def get_sku(sku_id, opts = {}) # Import Products using CSV # Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [ProductsImportCsvCreateResponseBody] - def import_products_using_csv(file, opts = {}) - data, _status_code, _headers = import_products_using_csv_with_http_info(file, opts) + def import_products_using_csv(opts = {}) + data, _status_code, _headers = import_products_using_csv_with_http_info(opts) data end # Import Products using CSV # Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [Array<(ProductsImportCsvCreateResponseBody, Integer, Hash)>] ProductsImportCsvCreateResponseBody data, response status code and response headers - private def import_products_using_csv_with_http_info(file, opts = {}) + private def import_products_using_csv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.import_products_using_csv ...' end - # verify the required parameter 'file' is set - if @api_client.config.client_side_validation && file.nil? - fail ArgumentError, "Missing the required parameter 'file' when calling ProductsApi.import_products_using_csv" - end # resource path local_var_path = '/v1/products/importCSV' @@ -454,7 +426,7 @@ def import_products_using_csv(file, opts = {}) # form parameters form_params = opts[:form_params] || {} - form_params['file'] = file + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] @@ -484,27 +456,23 @@ def import_products_using_csv(file, opts = {}) # Import SKUs using CSV # Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [SkusImportCsvCreateResponseBody] - def import_skus_using_csv(file, opts = {}) - data, _status_code, _headers = import_skus_using_csv_with_http_info(file, opts) + def import_skus_using_csv(opts = {}) + data, _status_code, _headers = import_skus_using_csv_with_http_info(opts) data end # Import SKUs using CSV # Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [Array<(SkusImportCsvCreateResponseBody, Integer, Hash)>] SkusImportCsvCreateResponseBody data, response status code and response headers - private def import_skus_using_csv_with_http_info(file, opts = {}) + private def import_skus_using_csv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.import_skus_using_csv ...' end - # verify the required parameter 'file' is set - if @api_client.config.client_side_validation && file.nil? - fail ArgumentError, "Missing the required parameter 'file' when calling ProductsApi.import_skus_using_csv" - end # resource path local_var_path = '/v1/skus/importCSV' @@ -523,7 +491,7 @@ def import_skus_using_csv(file, opts = {}) # form parameters form_params = opts[:form_params] || {} - form_params['file'] = file + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] @@ -554,8 +522,8 @@ def import_skus_using_csv(file, opts = {}) # List Products # Retrieve a list of products. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -568,8 +536,8 @@ def list_products(opts = {}) # List Products # Retrieve a list of products. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -578,18 +546,6 @@ def list_products(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.list_products ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductsApi.list_products, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductsApi.list_products, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ProductsApi.list_products, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/products' @@ -639,8 +595,8 @@ def list_products(opts = {}) # Retrieve all SKUs for a given product. # @param product_id [String] A Voucherify product ID or product source ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -654,8 +610,8 @@ def list_skus_in_product(product_id, opts = {}) # Retrieve all SKUs for a given product. # @param product_id [String] A Voucherify product ID or product source ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -664,22 +620,6 @@ def list_skus_in_product(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.list_skus_in_product ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.list_skus_in_product" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductsApi.list_skus_in_product, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ProductsApi.list_skus_in_product, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ProductsApi.list_skus_in_product, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/products/{productId}/skus'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)) @@ -746,10 +686,6 @@ def update_product(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.update_product ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.update_product" - end # resource path local_var_path = '/v1/products/{productId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)) @@ -795,20 +731,20 @@ def update_product(product_id, opts = {}) return data, status_code, headers end - # Update Products in bulk - # Update several products in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Products in Bulk + # Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [Array] :products_update_in_bulk_request_body Create an array of product objects, each with the parameters which you want to update. + # @option opts [Array] :products_update_in_bulk_request_body List the product fields to be updated in each customer object. # @return [ProductsUpdateInBulkResponseBody] def update_products_in_bulk(opts = {}) data, _status_code, _headers = update_products_in_bulk_with_http_info(opts) data end - # Update Products in bulk - # Update several products in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Products in Bulk + # Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [Array] :products_update_in_bulk_request_body Create an array of product objects, each with the parameters which you want to update. + # @option opts [Array] :products_update_in_bulk_request_body List the product fields to be updated in each customer object. # @return [Array<(ProductsUpdateInBulkResponseBody, Integer, Hash)>] ProductsUpdateInBulkResponseBody data, response status code and response headers private def update_products_in_bulk_with_http_info(opts = {}) if @api_client.config.debugging @@ -859,20 +795,20 @@ def update_products_in_bulk(opts = {}) return data, status_code, headers end - # Update Products' Metadata in bulk - # Update several product metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Products' Metadata in Bulk + # Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [ProductsMetadataUpdateInBulkRequestBody] :products_metadata_update_in_bulk_request_body Specify the list of product source IDs and the metadata key value pairs to be udpated for these products. + # @option opts [ProductsMetadataUpdateInBulkRequestBody] :products_metadata_update_in_bulk_request_body List the source_ids of the products you would like to update with the metadata key/value pairs. # @return [ProductsMetadataUpdateInBulkResponseBody] def update_products_metadata_in_bulk(opts = {}) data, _status_code, _headers = update_products_metadata_in_bulk_with_http_info(opts) data end - # Update Products' Metadata in bulk - # Update several product metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # Update Products' Metadata in Bulk + # Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. # @param [Hash] opts the optional parameters - # @option opts [ProductsMetadataUpdateInBulkRequestBody] :products_metadata_update_in_bulk_request_body Specify the list of product source IDs and the metadata key value pairs to be udpated for these products. + # @option opts [ProductsMetadataUpdateInBulkRequestBody] :products_metadata_update_in_bulk_request_body List the source_ids of the products you would like to update with the metadata key/value pairs. # @return [Array<(ProductsMetadataUpdateInBulkResponseBody, Integer, Hash)>] ProductsMetadataUpdateInBulkResponseBody data, response status code and response headers private def update_products_metadata_in_bulk_with_http_info(opts = {}) if @api_client.config.debugging @@ -946,14 +882,6 @@ def update_sku(product_id, sku_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductsApi.update_sku ...' end - # verify the required parameter 'product_id' is set - if @api_client.config.client_side_validation && product_id.nil? - fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.update_sku" - end - # verify the required parameter 'sku_id' is set - if @api_client.config.client_side_validation && sku_id.nil? - fail ArgumentError, "Missing the required parameter 'sku_id' when calling ProductsApi.update_sku" - end # resource path local_var_path = '/v1/products/{productId}/skus/{skuId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)).sub('{' + 'skuId' + '}', CGI.escape(sku_id.to_s)) diff --git a/lib/VoucherifySdk/api/promotions_api.rb b/lib/VoucherifySdk/api/promotions_api.rb index cde2aaa6..28952d89 100644 --- a/lib/VoucherifySdk/api/promotions_api.rb +++ b/lib/VoucherifySdk/api/promotions_api.rb @@ -19,6 +19,72 @@ class PromotionsApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Add Promotion Tier to Campaign + # This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + # @param campaign_id [String] Unique campaign ID assigned by Voucherify. + # @param [Hash] opts the optional parameters + # @option opts [PromotionsTiersCreateRequestBody] :promotions_tiers_create_request_body Specify the promotion tier parameters. + # @return [PromotionsTiersCreateResponseBody] + def add_promotion_tier_to_campaign(campaign_id, opts = {}) + data, _status_code, _headers = add_promotion_tier_to_campaign_with_http_info(campaign_id, opts) + data + end + + # Add Promotion Tier to Campaign + # This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + # @param campaign_id [String] Unique campaign ID assigned by Voucherify. + # @param [Hash] opts the optional parameters + # @option opts [PromotionsTiersCreateRequestBody] :promotions_tiers_create_request_body Specify the promotion tier parameters. + # @return [Array<(PromotionsTiersCreateResponseBody, Integer, Hash)>] PromotionsTiersCreateResponseBody data, response status code and response headers + private def add_promotion_tier_to_campaign_with_http_info(campaign_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PromotionsApi.add_promotion_tier_to_campaign ...' + end + # resource path + local_var_path = '/v1/promotions/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'promotions_tiers_create_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'PromotionsTiersCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"PromotionsApi.add_promotion_tier_to_campaign", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PromotionsApi#add_promotion_tier_to_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create Promotion Stack # This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. # @param campaign_id [String] Unique campaign ID. @@ -40,10 +106,6 @@ def create_promotion_stack(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.create_promotion_stack ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling PromotionsApi.create_promotion_stack" - end # resource path local_var_path = '/v1/promotions/{campaignId}/stacks'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -110,14 +172,6 @@ def delete_promotion_stack(campaign_id, stack_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.delete_promotion_stack ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling PromotionsApi.delete_promotion_stack" - end - # verify the required parameter 'stack_id' is set - if @api_client.config.client_side_validation && stack_id.nil? - fail ArgumentError, "Missing the required parameter 'stack_id' when calling PromotionsApi.delete_promotion_stack" - end # resource path local_var_path = '/v1/promotions/{campaignId}/stacks/{stackId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'stackId' + '}', CGI.escape(stack_id.to_s)) @@ -175,10 +229,6 @@ def delete_promotion_tier(promotion_tier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.delete_promotion_tier ...' end - # verify the required parameter 'promotion_tier_id' is set - if @api_client.config.client_side_validation && promotion_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'promotion_tier_id' when calling PromotionsApi.delete_promotion_tier" - end # resource path local_var_path = '/v1/promotions/tiers/{promotionTierId}'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s)) @@ -236,10 +286,6 @@ def disable_promotion_tier(promotion_tier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.disable_promotion_tier ...' end - # verify the required parameter 'promotion_tier_id' is set - if @api_client.config.client_side_validation && promotion_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'promotion_tier_id' when calling PromotionsApi.disable_promotion_tier" - end # resource path local_var_path = '/v1/promotions/tiers/{promotionTierId}/disable'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s)) @@ -299,10 +345,6 @@ def enable_promotion_tier(promotion_tier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.enable_promotion_tier ...' end - # verify the required parameter 'promotion_tier_id' is set - if @api_client.config.client_side_validation && promotion_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'promotion_tier_id' when calling PromotionsApi.enable_promotion_tier" - end # resource path local_var_path = '/v1/promotions/tiers/{promotionTierId}/enable'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s)) @@ -364,14 +406,6 @@ def get_promotion_stack(campaign_id, stack_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.get_promotion_stack ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling PromotionsApi.get_promotion_stack" - end - # verify the required parameter 'stack_id' is set - if @api_client.config.client_side_validation && stack_id.nil? - fail ArgumentError, "Missing the required parameter 'stack_id' when calling PromotionsApi.get_promotion_stack" - end # resource path local_var_path = '/v1/promotions/{campaignId}/stacks/{stackId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'stackId' + '}', CGI.escape(stack_id.to_s)) @@ -431,10 +465,6 @@ def get_promotion_tier(promotion_tier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.get_promotion_tier ...' end - # verify the required parameter 'promotion_tier_id' is set - if @api_client.config.client_side_validation && promotion_tier_id.nil? - fail ArgumentError, "Missing the required parameter 'promotion_tier_id' when calling PromotionsApi.get_promotion_tier" - end # resource path local_var_path = '/v1/promotions/tiers/{promotionTierId}'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s)) @@ -478,8 +508,8 @@ def get_promotion_tier(promotion_tier_id, opts = {}) # List Promotion Stacks # This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListAllPromotionStacks] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z # @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z @@ -492,8 +522,8 @@ def list_all_promotion_stacks(opts = {}) # List Promotion Stacks # This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListAllPromotionStacks] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z # @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z @@ -502,18 +532,6 @@ def list_all_promotion_stacks(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.list_all_promotion_stacks ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PromotionsApi.list_all_promotion_stacks, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PromotionsApi.list_all_promotion_stacks, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling PromotionsApi.list_all_promotion_stacks, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/promotions/stacks' @@ -578,10 +596,6 @@ def list_promotion_stacks_in_campaign(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.list_promotion_stacks_in_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling PromotionsApi.list_promotion_stacks_in_campaign" - end # resource path local_var_path = '/v1/promotions/{campaignId}/stacks'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -622,6 +636,75 @@ def list_promotion_stacks_in_campaign(campaign_id, opts = {}) return data, status_code, headers end + # List Promotion Tiers + # This method enables you to list promotion tiers. + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :is_available This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListPromotionTiers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [PromotionsTiersListResponseBody] + def list_promotion_tiers(opts = {}) + data, _status_code, _headers = list_promotion_tiers_with_http_info(opts) + data + end + + # List Promotion Tiers + # This method enables you to list promotion tiers. + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :is_available This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [ParameterOrderListPromotionTiers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @return [Array<(PromotionsTiersListResponseBody, Integer, Hash)>] PromotionsTiersListResponseBody data, response status code and response headers + private def list_promotion_tiers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PromotionsApi.list_promotion_tiers ...' + end + # resource path + local_var_path = '/v1/promotions/tiers' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'is_available'] = opts[:'is_available'] if !opts[:'is_available'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PromotionsTiersListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"PromotionsApi.list_promotion_tiers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PromotionsApi#list_promotion_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List Promotion Tiers from Campaign # This method enables you to list promotion tiers from a specified campaign. # @param campaign_id [String] Unique campaign ID assigned by Voucherify. @@ -641,10 +724,6 @@ def list_promotion_tiers_from_campaign(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.list_promotion_tiers_from_campaign ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling PromotionsApi.list_promotion_tiers_from_campaign" - end # resource path local_var_path = '/v1/promotions/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) @@ -708,14 +787,6 @@ def update_promotion_stack(campaign_id, stack_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PromotionsApi.update_promotion_stack ...' end - # verify the required parameter 'campaign_id' is set - if @api_client.config.client_side_validation && campaign_id.nil? - fail ArgumentError, "Missing the required parameter 'campaign_id' when calling PromotionsApi.update_promotion_stack" - end - # verify the required parameter 'stack_id' is set - if @api_client.config.client_side_validation && stack_id.nil? - fail ArgumentError, "Missing the required parameter 'stack_id' when calling PromotionsApi.update_promotion_stack" - end # resource path local_var_path = '/v1/promotions/{campaignId}/stacks/{stackId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'stackId' + '}', CGI.escape(stack_id.to_s)) @@ -760,5 +831,71 @@ def update_promotion_stack(campaign_id, stack_id, opts = {}) end return data, status_code, headers end + + # Update Promotion Tier + # This method updates a promotion tier. + # @param promotion_tier_id [String] Unique promotion tier ID. + # @param [Hash] opts the optional parameters + # @option opts [PromotionsTiersUpdateRequestBody] :promotions_tiers_update_request_body Specify the promotion tier parameters that you would like to update. + # @return [PromotionsTiersUpdateResponseBody] + def update_promotion_tier(promotion_tier_id, opts = {}) + data, _status_code, _headers = update_promotion_tier_with_http_info(promotion_tier_id, opts) + data + end + + # Update Promotion Tier + # This method updates a promotion tier. + # @param promotion_tier_id [String] Unique promotion tier ID. + # @param [Hash] opts the optional parameters + # @option opts [PromotionsTiersUpdateRequestBody] :promotions_tiers_update_request_body Specify the promotion tier parameters that you would like to update. + # @return [Array<(PromotionsTiersUpdateResponseBody, Integer, Hash)>] PromotionsTiersUpdateResponseBody data, response status code and response headers + private def update_promotion_tier_with_http_info(promotion_tier_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PromotionsApi.update_promotion_tier ...' + end + # resource path + local_var_path = '/v1/promotions/tiers/{promotionTierId}'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'promotions_tiers_update_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'PromotionsTiersUpdateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"PromotionsApi.update_promotion_tier", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PromotionsApi#update_promotion_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/VoucherifySdk/api/publications_api.rb b/lib/VoucherifySdk/api/publications_api.rb index ec9a0473..2ade83d1 100644 --- a/lib/VoucherifySdk/api/publications_api.rb +++ b/lib/VoucherifySdk/api/publications_api.rb @@ -93,7 +93,7 @@ def create_publication(opts = {}) # @option opts [Boolean] :join_once Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. # @option opts [String] :voucher Code of voucher being published. # @option opts [CreatePublicationCampaign] :campaign Create publication with campaign. - # @option opts [String] :source_id The merchant’s publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. + # @option opts [String] :source_id The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. # @option opts [Object] :metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. # @return [PublicationsCreateResponseBody] def create_publication1(customer, opts = {}) @@ -108,17 +108,13 @@ def create_publication1(customer, opts = {}) # @option opts [Boolean] :join_once Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. # @option opts [String] :voucher Code of voucher being published. # @option opts [CreatePublicationCampaign] :campaign Create publication with campaign. - # @option opts [String] :source_id The merchant’s publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. + # @option opts [String] :source_id The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. # @option opts [Object] :metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. # @return [Array<(PublicationsCreateResponseBody, Integer, Hash)>] PublicationsCreateResponseBody data, response status code and response headers private def create_publication1_with_http_info(customer, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicationsApi.create_publication1 ...' end - # verify the required parameter 'customer' is set - if @api_client.config.client_side_validation && customer.nil? - fail ArgumentError, "Missing the required parameter 'customer' when calling PublicationsApi.create_publication1" - end # resource path local_var_path = '/v1/publications/create' @@ -168,8 +164,8 @@ def create_publication1(customer, opts = {}) # List Publications # Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination 🚧 Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListPublications] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [String] :campaign Filters by a given campaign name. # @option opts [String] :customer Filters by a unique customer ID. @@ -188,8 +184,8 @@ def list_publications(opts = {}) # List Publications # Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination 🚧 Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListPublications] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [String] :campaign Filters by a given campaign name. # @option opts [String] :customer Filters by a unique customer ID. @@ -204,18 +200,6 @@ def list_publications(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicationsApi.list_publications ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PublicationsApi.list_publications, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PublicationsApi.list_publications, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling PublicationsApi.list_publications, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/publications' diff --git a/lib/VoucherifySdk/api/qualifications_api.rb b/lib/VoucherifySdk/api/qualifications_api.rb index 15cbaaa6..8fcd8c54 100644 --- a/lib/VoucherifySdk/api/qualifications_api.rb +++ b/lib/VoucherifySdk/api/qualifications_api.rb @@ -20,7 +20,7 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Check Eligibility - # 🚧 The Qualifications endpoint in the basic mode ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + # 🚧 The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. # @param [Hash] opts the optional parameters # @option opts [QualificationsCheckEligibilityRequestBody] :qualifications_check_eligibility_request_body Define order and customer context. # @return [QualificationsCheckEligibilityResponseBody] @@ -30,7 +30,7 @@ def check_eligibility(opts = {}) end # Check Eligibility - # 🚧 The Qualifications endpoint in the basic mode ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + # 🚧 The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. # @param [Hash] opts the optional parameters # @option opts [QualificationsCheckEligibilityRequestBody] :qualifications_check_eligibility_request_body Define order and customer context. # @return [Array<(QualificationsCheckEligibilityResponseBody, Integer, Hash)>] QualificationsCheckEligibilityResponseBody data, response status code and response headers diff --git a/lib/VoucherifySdk/api/redemptions_api.rb b/lib/VoucherifySdk/api/redemptions_api.rb index 26616d7d..c9cb51aa 100644 --- a/lib/VoucherifySdk/api/redemptions_api.rb +++ b/lib/VoucherifySdk/api/redemptions_api.rb @@ -38,10 +38,6 @@ def get_redemption(redemption_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedemptionsApi.get_redemption ...' end - # verify the required parameter 'redemption_id' is set - if @api_client.config.client_side_validation && redemption_id.nil? - fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.get_redemption" - end # resource path local_var_path = '/v1/redemptions/{redemptionId}'.sub('{' + 'redemptionId' + '}', CGI.escape(redemption_id.to_s)) @@ -101,10 +97,6 @@ def get_voucher_redemptions(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedemptionsApi.get_voucher_redemptions ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling RedemptionsApi.get_voucher_redemptions" - end # resource path local_var_path = '/v1/vouchers/{code}/redemption'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -148,8 +140,8 @@ def get_voucher_redemptions(code, opts = {}) # List Redemptions # Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [String] :result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. # @option opts [String] :campaign A filter by the campaign **name** that the redemption resources originate from. # @option opts [String] :customer Return redemptions performed by the customer with given id or source_id. @@ -165,8 +157,8 @@ def list_redemptions(opts = {}) # List Redemptions # Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [String] :result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. # @option opts [String] :campaign A filter by the campaign **name** that the redemption resources originate from. # @option opts [String] :customer Return redemptions performed by the customer with given id or source_id. @@ -178,18 +170,6 @@ def list_redemptions(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedemptionsApi.list_redemptions ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RedemptionsApi.list_redemptions, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RedemptionsApi.list_redemptions, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling RedemptionsApi.list_redemptions, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/redemptions' @@ -303,7 +283,7 @@ def redeem_stacked_discounts(opts = {}) end # Rollback Redemption - # Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + # Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. 🚧 You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. # @param redemption_id [String] The original redemption ID to be rolled back (undone). # @param [Hash] opts the optional parameters # @option opts [String] :reason Reason for the rollback. @@ -316,7 +296,7 @@ def rollback_redemption(redemption_id, opts = {}) end # Rollback Redemption - # Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + # Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. 🚧 You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. # @param redemption_id [String] The original redemption ID to be rolled back (undone). # @param [Hash] opts the optional parameters # @option opts [String] :reason Reason for the rollback. @@ -327,10 +307,6 @@ def rollback_redemption(redemption_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedemptionsApi.rollback_redemption ...' end - # verify the required parameter 'redemption_id' is set - if @api_client.config.client_side_validation && redemption_id.nil? - fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.rollback_redemption" - end # resource path local_var_path = '/v1/redemptions/{redemptionId}/rollback'.sub('{' + 'redemptionId' + '}', CGI.escape(redemption_id.to_s)) @@ -379,7 +355,7 @@ def rollback_redemption(redemption_id, opts = {}) end # Rollback Stackable Redemptions - # Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. + # Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. 🚧 You can roll back a redemption up to 3 months back. # @param parent_redemption_id [String] Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. # @param [Hash] opts the optional parameters # @option opts [String] :reason Reason for the rollback. @@ -392,7 +368,7 @@ def rollback_stacked_redemptions(parent_redemption_id, opts = {}) end # Rollback Stackable Redemptions - # Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. + # Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. 🚧 You can roll back a redemption up to 3 months back. # @param parent_redemption_id [String] Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. # @param [Hash] opts the optional parameters # @option opts [String] :reason Reason for the rollback. @@ -403,10 +379,6 @@ def rollback_stacked_redemptions(parent_redemption_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedemptionsApi.rollback_stacked_redemptions ...' end - # verify the required parameter 'parent_redemption_id' is set - if @api_client.config.client_side_validation && parent_redemption_id.nil? - fail ArgumentError, "Missing the required parameter 'parent_redemption_id' when calling RedemptionsApi.rollback_stacked_redemptions" - end # resource path local_var_path = '/v1/redemptions/{parentRedemptionId}/rollbacks'.sub('{' + 'parentRedemptionId' + '}', CGI.escape(parent_redemption_id.to_s)) diff --git a/lib/VoucherifySdk/api/rewards_api.rb b/lib/VoucherifySdk/api/rewards_api.rb index 3e96d13a..f854e2cc 100644 --- a/lib/VoucherifySdk/api/rewards_api.rb +++ b/lib/VoucherifySdk/api/rewards_api.rb @@ -19,6 +19,70 @@ class RewardsApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Create Reward + # Create a new reward. + # @param [Hash] opts the optional parameters + # @option opts [RewardsCreateRequestBody] :rewards_create_request_body Define parameters of the new reward. + # @return [RewardsCreateResponseBody] + def create_reward(opts = {}) + data, _status_code, _headers = create_reward_with_http_info(opts) + data + end + + # Create Reward + # Create a new reward. + # @param [Hash] opts the optional parameters + # @option opts [RewardsCreateRequestBody] :rewards_create_request_body Define parameters of the new reward. + # @return [Array<(RewardsCreateResponseBody, Integer, Hash)>] RewardsCreateResponseBody data, response status code and response headers + private def create_reward_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.create_reward ...' + end + # resource path + local_var_path = '/v1/rewards' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'rewards_create_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'RewardsCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"RewardsApi.create_reward", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#create_reward\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create Reward Assignment # Assigns a reward to a specified loyalty campaign. # @param reward_id [String] A unique reward ID. @@ -40,10 +104,6 @@ def create_reward_assignment(reward_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RewardsApi.create_reward_assignment ...' end - # verify the required parameter 'reward_id' is set - if @api_client.config.client_side_validation && reward_id.nil? - fail ArgumentError, "Missing the required parameter 'reward_id' when calling RewardsApi.create_reward_assignment" - end # resource path local_var_path = '/v1/rewards/{rewardId}/assignments'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)) @@ -108,10 +168,6 @@ def delete_reward(reward_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RewardsApi.delete_reward ...' end - # verify the required parameter 'reward_id' is set - if @api_client.config.client_side_validation && reward_id.nil? - fail ArgumentError, "Missing the required parameter 'reward_id' when calling RewardsApi.delete_reward" - end # resource path local_var_path = '/v1/rewards/{rewardId}'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)) @@ -171,14 +227,6 @@ def delete_reward_assignment(reward_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RewardsApi.delete_reward_assignment ...' end - # verify the required parameter 'reward_id' is set - if @api_client.config.client_side_validation && reward_id.nil? - fail ArgumentError, "Missing the required parameter 'reward_id' when calling RewardsApi.delete_reward_assignment" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling RewardsApi.delete_reward_assignment" - end # resource path local_var_path = '/v1/rewards/{rewardId}/assignments/{assignmentId}'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -217,6 +265,65 @@ def delete_reward_assignment(reward_id, assignment_id, opts = {}) return data, status_code, headers end + # Get Reward + # Retrieve a reward by the reward ID. + # @param reward_id [String] A unique reward ID. + # @param [Hash] opts the optional parameters + # @return [Reward] + def get_reward(reward_id, opts = {}) + data, _status_code, _headers = get_reward_with_http_info(reward_id, opts) + data + end + + # Get Reward + # Retrieve a reward by the reward ID. + # @param reward_id [String] A unique reward ID. + # @param [Hash] opts the optional parameters + # @return [Array<(Reward, Integer, Hash)>] Reward data, response status code and response headers + private def get_reward_with_http_info(reward_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.get_reward ...' + end + # resource path + local_var_path = '/v1/rewards/{rewardId}'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Reward' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"RewardsApi.get_reward", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#get_reward\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get Reward Assignment # Retrieve a reward assignment. # @param reward_id [String] A unique reward ID. @@ -238,14 +345,6 @@ def get_reward_assignment(reward_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RewardsApi.get_reward_assignment ...' end - # verify the required parameter 'reward_id' is set - if @api_client.config.client_side_validation && reward_id.nil? - fail ArgumentError, "Missing the required parameter 'reward_id' when calling RewardsApi.get_reward_assignment" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling RewardsApi.get_reward_assignment" - end # resource path local_var_path = '/v1/rewards/{rewardId}/assignments/{assignmentId}'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -290,8 +389,8 @@ def get_reward_assignment(reward_id, assignment_id, opts = {}) # Retrieve reward assignments by the reward ID. # @param reward_id [String] A unique reward ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @return [RewardsAssignmentsListResponseBody] def list_reward_assignments(reward_id, opts = {}) data, _status_code, _headers = list_reward_assignments_with_http_info(reward_id, opts) @@ -302,29 +401,13 @@ def list_reward_assignments(reward_id, opts = {}) # Retrieve reward assignments by the reward ID. # @param reward_id [String] A unique reward ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @return [Array<(RewardsAssignmentsListResponseBody, Integer, Hash)>] RewardsAssignmentsListResponseBody data, response status code and response headers private def list_reward_assignments_with_http_info(reward_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RewardsApi.list_reward_assignments ...' end - # verify the required parameter 'reward_id' is set - if @api_client.config.client_side_validation && reward_id.nil? - fail ArgumentError, "Missing the required parameter 'reward_id' when calling RewardsApi.list_reward_assignments" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RewardsApi.list_reward_assignments, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RewardsApi.list_reward_assignments, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling RewardsApi.list_reward_assignments, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/rewards/{rewardId}/assignments'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)) @@ -367,6 +450,138 @@ def list_reward_assignments(reward_id, opts = {}) return data, status_code, headers end + # List Rewards + # Retrieve rewards. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :assignment_id A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. + # @return [RewardsListResponseBody] + def list_rewards(opts = {}) + data, _status_code, _headers = list_rewards_with_http_info(opts) + data + end + + # List Rewards + # Retrieve rewards. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :assignment_id A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. + # @return [Array<(RewardsListResponseBody, Integer, Hash)>] RewardsListResponseBody data, response status code and response headers + private def list_rewards_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.list_rewards ...' + end + # resource path + local_var_path = '/v1/rewards' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'assignment_id'] = opts[:'assignment_id'] if !opts[:'assignment_id'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RewardsListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"RewardsApi.list_rewards", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#list_rewards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Reward + # Update the details of a reward. + # @param reward_id [String] A unique reward ID. + # @param [Hash] opts the optional parameters + # @option opts [RewardsUpdateRequestBody] :rewards_update_request_body Define the parameters to be updated for the reward. + # @return [RewardsUpdateResponseBody] + def update_reward(reward_id, opts = {}) + data, _status_code, _headers = update_reward_with_http_info(reward_id, opts) + data + end + + # Update Reward + # Update the details of a reward. + # @param reward_id [String] A unique reward ID. + # @param [Hash] opts the optional parameters + # @option opts [RewardsUpdateRequestBody] :rewards_update_request_body Define the parameters to be updated for the reward. + # @return [Array<(RewardsUpdateResponseBody, Integer, Hash)>] RewardsUpdateResponseBody data, response status code and response headers + private def update_reward_with_http_info(reward_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.update_reward ...' + end + # resource path + local_var_path = '/v1/rewards/{rewardId}'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'rewards_update_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'RewardsUpdateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"RewardsApi.update_reward", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#update_reward\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update Reward Assignment # Update the number of points needed to successfully redeem the reward. # @param reward_id [String] A unique reward ID. @@ -390,14 +605,6 @@ def update_reward_assignment(reward_id, assignment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RewardsApi.update_reward_assignment ...' end - # verify the required parameter 'reward_id' is set - if @api_client.config.client_side_validation && reward_id.nil? - fail ArgumentError, "Missing the required parameter 'reward_id' when calling RewardsApi.update_reward_assignment" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling RewardsApi.update_reward_assignment" - end # resource path local_var_path = '/v1/rewards/{rewardId}/assignments/{assignmentId}'.sub('{' + 'rewardId' + '}', CGI.escape(reward_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) diff --git a/lib/VoucherifySdk/api/segments_api.rb b/lib/VoucherifySdk/api/segments_api.rb index cde4f208..b8694a28 100644 --- a/lib/VoucherifySdk/api/segments_api.rb +++ b/lib/VoucherifySdk/api/segments_api.rb @@ -19,6 +19,70 @@ class SegmentsApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Create Segment + # Create a customer segment. 🚧 Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + # @param [Hash] opts the optional parameters + # @option opts [SegmentsCreateRequestBody] :segments_create_request_body Specify the boundary conditions for the customer segment. + # @return [SegmentsCreateResponseBody] + def create_segment(opts = {}) + data, _status_code, _headers = create_segment_with_http_info(opts) + data + end + + # Create Segment + # Create a customer segment. 🚧 Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + # @param [Hash] opts the optional parameters + # @option opts [SegmentsCreateRequestBody] :segments_create_request_body Specify the boundary conditions for the customer segment. + # @return [Array<(SegmentsCreateResponseBody, Integer, Hash)>] SegmentsCreateResponseBody data, response status code and response headers + private def create_segment_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SegmentsApi.create_segment ...' + end + # resource path + local_var_path = '/v1/segments' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'segments_create_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'SegmentsCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"SegmentsApi.create_segment", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SegmentsApi#create_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete Segment # This method deletes a customer segment. # @param segment_id [String] A unique customer segment ID. @@ -38,10 +102,6 @@ def delete_segment(segment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.delete_segment ...' end - # verify the required parameter 'segment_id' is set - if @api_client.config.client_side_validation && segment_id.nil? - fail ArgumentError, "Missing the required parameter 'segment_id' when calling SegmentsApi.delete_segment" - end # resource path local_var_path = '/v1/segments/{segmentId}'.sub('{' + 'segmentId' + '}', CGI.escape(segment_id.to_s)) @@ -79,5 +139,64 @@ def delete_segment(segment_id, opts = {}) end return data, status_code, headers end + + # Get Segment + # Retrieves the segment with given segment ID. + # @param segment_id [String] A unique customer segment ID. + # @param [Hash] opts the optional parameters + # @return [SegmentsGetResponseBody] + def get_segment(segment_id, opts = {}) + data, _status_code, _headers = get_segment_with_http_info(segment_id, opts) + data + end + + # Get Segment + # Retrieves the segment with given segment ID. + # @param segment_id [String] A unique customer segment ID. + # @param [Hash] opts the optional parameters + # @return [Array<(SegmentsGetResponseBody, Integer, Hash)>] SegmentsGetResponseBody data, response status code and response headers + private def get_segment_with_http_info(segment_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment ...' + end + # resource path + local_var_path = '/v1/segments/{segmentId}'.sub('{' + 'segmentId' + '}', CGI.escape(segment_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SegmentsGetResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"SegmentsApi.get_segment", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SegmentsApi#get_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/VoucherifySdk/api/validation_rules_api.rb b/lib/VoucherifySdk/api/validation_rules_api.rb index 60854ea1..8f6d94f6 100644 --- a/lib/VoucherifySdk/api/validation_rules_api.rb +++ b/lib/VoucherifySdk/api/validation_rules_api.rb @@ -42,10 +42,6 @@ def create_validation_rule_assignment(validation_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.create_validation_rule_assignment ...' end - # verify the required parameter 'validation_rule_id' is set - if @api_client.config.client_side_validation && validation_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'validation_rule_id' when calling ValidationRulesApi.create_validation_rule_assignment" - end # resource path local_var_path = '/v1/validation-rules/{validationRuleId}/assignments'.sub('{' + 'validationRuleId' + '}', CGI.escape(validation_rule_id.to_s)) @@ -177,14 +173,6 @@ def delete_validation_rule_assignment(validation_rule_id, assignment_id, opts = if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.delete_validation_rule_assignment ...' end - # verify the required parameter 'validation_rule_id' is set - if @api_client.config.client_side_validation && validation_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'validation_rule_id' when calling ValidationRulesApi.delete_validation_rule_assignment" - end - # verify the required parameter 'assignment_id' is set - if @api_client.config.client_side_validation && assignment_id.nil? - fail ArgumentError, "Missing the required parameter 'assignment_id' when calling ValidationRulesApi.delete_validation_rule_assignment" - end # resource path local_var_path = '/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}'.sub('{' + 'validationRuleId' + '}', CGI.escape(validation_rule_id.to_s)).sub('{' + 'assignmentId' + '}', CGI.escape(assignment_id.to_s)) @@ -242,10 +230,6 @@ def delete_validation_rules(validation_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.delete_validation_rules ...' end - # verify the required parameter 'validation_rule_id' is set - if @api_client.config.client_side_validation && validation_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'validation_rule_id' when calling ValidationRulesApi.delete_validation_rules" - end # resource path local_var_path = '/v1/validation-rules/{validationRuleId}'.sub('{' + 'validationRuleId' + '}', CGI.escape(validation_rule_id.to_s)) @@ -303,10 +287,6 @@ def get_validation_rule(validation_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.get_validation_rule ...' end - # verify the required parameter 'validation_rule_id' is set - if @api_client.config.client_side_validation && validation_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'validation_rule_id' when calling ValidationRulesApi.get_validation_rule" - end # resource path local_var_path = '/v1/validation-rules/{validationRuleId}'.sub('{' + 'validationRuleId' + '}', CGI.escape(validation_rule_id.to_s)) @@ -351,8 +331,8 @@ def get_validation_rule(validation_rule_id, opts = {}) # Retrieve validation rule assignments for a specific validation rule. # @param validation_rule_id [String] Unique validation rule ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListValidationRuleAssignments] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [ValidationRulesAssignmentsListResponseBody] def list_validation_rule_assignments(validation_rule_id, opts = {}) @@ -364,30 +344,14 @@ def list_validation_rule_assignments(validation_rule_id, opts = {}) # Retrieve validation rule assignments for a specific validation rule. # @param validation_rule_id [String] Unique validation rule ID. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListValidationRuleAssignments] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @return [Array<(ValidationRulesAssignmentsListResponseBody, Integer, Hash)>] ValidationRulesAssignmentsListResponseBody data, response status code and response headers private def list_validation_rule_assignments_with_http_info(validation_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.list_validation_rule_assignments ...' end - # verify the required parameter 'validation_rule_id' is set - if @api_client.config.client_side_validation && validation_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'validation_rule_id' when calling ValidationRulesApi.list_validation_rule_assignments" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ValidationRulesApi.list_validation_rule_assignments, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ValidationRulesApi.list_validation_rule_assignments, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ValidationRulesApi.list_validation_rule_assignments, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/validation-rules/{validationRuleId}/assignments'.sub('{' + 'validationRuleId' + '}', CGI.escape(validation_rule_id.to_s)) @@ -434,8 +398,8 @@ def list_validation_rule_assignments(validation_rule_id, opts = {}) # List Validation Rules # Retrieve validation rules. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListValidationRules] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :start_date Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -448,8 +412,8 @@ def list_validation_rules(opts = {}) # List Validation Rules # Retrieve validation rules. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @option opts [ParameterOrderListValidationRules] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. # @option opts [Time] :start_date Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. # @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @@ -458,18 +422,6 @@ def list_validation_rules(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.list_validation_rules ...' end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ValidationRulesApi.list_validation_rules, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ValidationRulesApi.list_validation_rules, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ValidationRulesApi.list_validation_rules, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/validation-rules' @@ -520,8 +472,8 @@ def list_validation_rules(opts = {}) # @param [Hash] opts the optional parameters # @option opts [String] :related_object_id The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. # @option opts [String] :rule Validation rule ID. - # @option opts [Integer] :page Which page of results to return. - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [String] :order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. # @return [ValidationRulesAssignmentsListResponseBody] def list_validation_rules_assignments(opts = {}) @@ -534,26 +486,14 @@ def list_validation_rules_assignments(opts = {}) # @param [Hash] opts the optional parameters # @option opts [String] :related_object_id The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. # @option opts [String] :rule Validation rule ID. - # @option opts [Integer] :page Which page of results to return. - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [String] :order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. # @return [Array<(ValidationRulesAssignmentsListResponseBody, Integer, Hash)>] ValidationRulesAssignmentsListResponseBody data, response status code and response headers private def list_validation_rules_assignments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.list_validation_rules_assignments ...' end - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ValidationRulesApi.list_validation_rules_assignments, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ValidationRulesApi.list_validation_rules_assignments, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ValidationRulesApi.list_validation_rules_assignments, must be greater than or equal to 1.' - end - # resource path local_var_path = '/v1/validation-rules-assignments' @@ -620,10 +560,6 @@ def update_validation_rule(validation_rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidationRulesApi.update_validation_rule ...' end - # verify the required parameter 'validation_rule_id' is set - if @api_client.config.client_side_validation && validation_rule_id.nil? - fail ArgumentError, "Missing the required parameter 'validation_rule_id' when calling ValidationRulesApi.update_validation_rule" - end # resource path local_var_path = '/v1/validation-rules/{validationRuleId}'.sub('{' + 'validationRuleId' + '}', CGI.escape(validation_rule_id.to_s)) diff --git a/lib/VoucherifySdk/api/vouchers_api.rb b/lib/VoucherifySdk/api/vouchers_api.rb index 28b87330..451a949a 100644 --- a/lib/VoucherifySdk/api/vouchers_api.rb +++ b/lib/VoucherifySdk/api/vouchers_api.rb @@ -19,11 +19,77 @@ class VouchersApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Create Voucher + # Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + # @param code [String] A unique **code** that identifies the voucher. + # @param [Hash] opts the optional parameters + # @option opts [VouchersCreateWithSpecificCodeRequestBody] :vouchers_create_with_specific_code_request_body Specify the details of the voucher that you would like to create. + # @return [VouchersCreateResponseBody] + def create_voucher(code, opts = {}) + data, _status_code, _headers = create_voucher_with_http_info(code, opts) + data + end + + # Create Voucher + # Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + # @param code [String] A unique **code** that identifies the voucher. + # @param [Hash] opts the optional parameters + # @option opts [VouchersCreateWithSpecificCodeRequestBody] :vouchers_create_with_specific_code_request_body Specify the details of the voucher that you would like to create. + # @return [Array<(VouchersCreateResponseBody, Integer, Hash)>] VouchersCreateResponseBody data, response status code and response headers + private def create_voucher_with_http_info(code, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.create_voucher ...' + end + # resource path + local_var_path = '/v1/vouchers/{code}'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'vouchers_create_with_specific_code_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'VouchersCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.create_voucher", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#create_voucher\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete Voucher - # Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. + # Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. # @param code [String] A unique **code** that identifies the voucher. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the voucher will be removed permanently. Going forward, the user will be able to create another voucher with exactly the same code. + # @option opts [Boolean] :force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. # @return [nil] def delete_voucher(code, opts = {}) delete_voucher_with_http_info(code, opts) @@ -31,19 +97,15 @@ def delete_voucher(code, opts = {}) end # Delete Voucher - # Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. + # Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. # @param code [String] A unique **code** that identifies the voucher. # @param [Hash] opts the optional parameters - # @option opts [Boolean] :force If this flag is set to true, the voucher will be removed permanently. Going forward, the user will be able to create another voucher with exactly the same code. + # @option opts [Boolean] :force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers private def delete_voucher_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.delete_voucher ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.delete_voucher" - end # resource path local_var_path = '/v1/vouchers/{code}'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -102,10 +164,6 @@ def disable_voucher(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.disable_voucher ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.disable_voucher" - end # resource path local_var_path = '/v1/vouchers/{code}/disable'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -165,10 +223,6 @@ def enable_voucher(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.enable_voucher ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.enable_voucher" - end # resource path local_var_path = '/v1/vouchers/{code}/enable'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -230,10 +284,6 @@ def export_voucher_transactions(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.export_voucher_transactions ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.export_voucher_transactions" - end # resource path local_var_path = '/v1/vouchers/{code}/transactions/export'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -279,6 +329,70 @@ def export_voucher_transactions(code, opts = {}) return data, status_code, headers end + # Generate Random Code + # Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + # @param [Hash] opts the optional parameters + # @option opts [Object] :body Specify the details of the voucher that you would like to create. + # @return [VouchersCreateResponseBody] + def generate_random_code(opts = {}) + data, _status_code, _headers = generate_random_code_with_http_info(opts) + data + end + + # Generate Random Code + # Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + # @param [Hash] opts the optional parameters + # @option opts [Object] :body Specify the details of the voucher that you would like to create. + # @return [Array<(VouchersCreateResponseBody, Integer, Hash)>] VouchersCreateResponseBody data, response status code and response headers + private def generate_random_code_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.generate_random_code ...' + end + # resource path + local_var_path = '/v1/vouchers' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) + + # return_type + return_type = opts[:debug_return_type] || 'VouchersCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.generate_random_code", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#generate_random_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get Voucher # Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr. # @param code [String] A unique **code** that identifies the voucher. @@ -298,10 +412,6 @@ def get_voucher(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.get_voucher ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.get_voucher" - end # resource path local_var_path = '/v1/vouchers/{code}'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -342,29 +452,89 @@ def get_voucher(code, opts = {}) return data, status_code, headers end + # Import Vouchers + # Import standalone vouchers and gift cards into the repository. 📘 Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # @param vouchers_import_create_item_request_body [Array] The request body is an array of objects. Each object contains details about a specific voucher. + # @param [Hash] opts the optional parameters + # @return [VouchersImportCreateResponseBody] + def import_vouchers(vouchers_import_create_item_request_body, opts = {}) + data, _status_code, _headers = import_vouchers_with_http_info(vouchers_import_create_item_request_body, opts) + data + end + + # Import Vouchers + # Import standalone vouchers and gift cards into the repository. 📘 Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + # @param vouchers_import_create_item_request_body [Array] The request body is an array of objects. Each object contains details about a specific voucher. + # @param [Hash] opts the optional parameters + # @return [Array<(VouchersImportCreateResponseBody, Integer, Hash)>] VouchersImportCreateResponseBody data, response status code and response headers + private def import_vouchers_with_http_info(vouchers_import_create_item_request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.import_vouchers ...' + end + # resource path + local_var_path = '/v1/vouchers/import' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(vouchers_import_create_item_request_body) + + # return_type + return_type = opts[:debug_return_type] || 'VouchersImportCreateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.import_vouchers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#import_vouchers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Import Vouchers using CSV # Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ 📘 Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. 📘 Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [VouchersImportCsvCreateResponseBody] - def import_vouchers_using_csv(file, opts = {}) - data, _status_code, _headers = import_vouchers_using_csv_with_http_info(file, opts) + def import_vouchers_using_csv(opts = {}) + data, _status_code, _headers = import_vouchers_using_csv_with_http_info(opts) data end # Import Vouchers using CSV # Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ 📘 Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. 📘 Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. - # @param file [File] File path. # @param [Hash] opts the optional parameters + # @option opts [File] :file File path. # @return [Array<(VouchersImportCsvCreateResponseBody, Integer, Hash)>] VouchersImportCsvCreateResponseBody data, response status code and response headers - private def import_vouchers_using_csv_with_http_info(file, opts = {}) + private def import_vouchers_using_csv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.import_vouchers_using_csv ...' end - # verify the required parameter 'file' is set - if @api_client.config.client_side_validation && file.nil? - fail ArgumentError, "Missing the required parameter 'file' when calling VouchersApi.import_vouchers_using_csv" - end # resource path local_var_path = '/v1/vouchers/importCSV' @@ -383,7 +553,7 @@ def import_vouchers_using_csv(file, opts = {}) # form parameters form_params = opts[:form_params] || {} - form_params['file'] = file + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] @@ -415,8 +585,8 @@ def import_vouchers_using_csv(file, opts = {}) # List transactions that are associated with credit movements on a gift card or loyalty card. # @param code [String] A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @return [VouchersTransactionsListResponseBody] def list_voucher_transactions(code, opts = {}) data, _status_code, _headers = list_voucher_transactions_with_http_info(code, opts) @@ -427,29 +597,13 @@ def list_voucher_transactions(code, opts = {}) # List transactions that are associated with credit movements on a gift card or loyalty card. # @param code [String] A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100 items. - # @option opts [Integer] :page Which page of results to return. + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. # @return [Array<(VouchersTransactionsListResponseBody, Integer, Hash)>] VouchersTransactionsListResponseBody data, response status code and response headers private def list_voucher_transactions_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.list_voucher_transactions ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.list_voucher_transactions" - end - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling VouchersApi.list_voucher_transactions, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 - fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling VouchersApi.list_voucher_transactions, must be greater than or equal to 1.' - end - - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 100 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling VouchersApi.list_voucher_transactions, must be smaller than or equal to 100.' - end - # resource path local_var_path = '/v1/vouchers/{code}/transactions'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -492,6 +646,96 @@ def list_voucher_transactions(code, opts = {}) return data, status_code, headers end + # List Vouchers + # Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :category Limit search results to vouchers within the specified category. + # @option opts [String] :campaign_id Limit search results to vouchers within the specified campaign + # @option opts [String] :customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + # @option opts [String] :campaign A unique campaign name, identifies the parent campaign. + # @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterOrderVouchers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :code + # @option opts [Array] :ids + # @return [VouchersListResponseBody] + def list_vouchers(opts = {}) + data, _status_code, _headers = list_vouchers_with_http_info(opts) + data + end + + # List Vouchers + # Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + # @option opts [Integer] :page Which page of results to return. The lowest value is 1. + # @option opts [String] :category Limit search results to vouchers within the specified category. + # @option opts [String] :campaign_id Limit search results to vouchers within the specified campaign + # @option opts [String] :customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + # @option opts [String] :campaign A unique campaign name, identifies the parent campaign. + # @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + # @option opts [ParameterOrderVouchers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + # @option opts [String] :code + # @option opts [Array] :ids + # @return [Array<(VouchersListResponseBody, Integer, Hash)>] VouchersListResponseBody data, response status code and response headers + private def list_vouchers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.list_vouchers ...' + end + # resource path + local_var_path = '/v1/vouchers' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'category'] = opts[:'category'] if !opts[:'category'].nil? + query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? + query_params[:'customer'] = opts[:'customer'] if !opts[:'customer'].nil? + query_params[:'campaign'] = opts[:'campaign'] if !opts[:'campaign'].nil? + query_params[:'created_at'] = opts[:'created_at'] if !opts[:'created_at'].nil? + query_params[:'updated_at'] = opts[:'updated_at'] if !opts[:'updated_at'].nil? + query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? + query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil? + query_params[:'ids'] = @api_client.build_collection_param(opts[:'ids'], :multi) if !opts[:'ids'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'VouchersListResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.list_vouchers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#list_vouchers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Release Validation Session # Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. 📘 Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations). # @param code [String] A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. @@ -513,14 +757,6 @@ def release_validation_session(code, session_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.release_validation_session ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.release_validation_session" - end - # verify the required parameter 'session_key' is set - if @api_client.config.client_side_validation && session_key.nil? - fail ArgumentError, "Missing the required parameter 'session_key' when calling VouchersApi.release_validation_session" - end # resource path local_var_path = '/v1/vouchers/{code}/sessions/{sessionKey}'.sub('{' + 'code' + '}', CGI.escape(code.to_s)).sub('{' + 'sessionKey' + '}', CGI.escape(session_key.to_s)) @@ -559,6 +795,72 @@ def release_validation_session(code, session_key, opts = {}) return data, status_code, headers end + # Update Voucher + # Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + # @param code [String] A unique **code** that identifies the voucher. + # @param vouchers_update_request_body [VouchersUpdateRequestBody] Specify the parameters to be updated. + # @param [Hash] opts the optional parameters + # @return [VouchersUpdateResponseBody] + def update_voucher(code, vouchers_update_request_body, opts = {}) + data, _status_code, _headers = update_voucher_with_http_info(code, vouchers_update_request_body, opts) + data + end + + # Update Voucher + # Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + # @param code [String] A unique **code** that identifies the voucher. + # @param vouchers_update_request_body [VouchersUpdateRequestBody] Specify the parameters to be updated. + # @param [Hash] opts the optional parameters + # @return [Array<(VouchersUpdateResponseBody, Integer, Hash)>] VouchersUpdateResponseBody data, response status code and response headers + private def update_voucher_with_http_info(code, vouchers_update_request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.update_voucher ...' + end + # resource path + local_var_path = '/v1/vouchers/{code}'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(vouchers_update_request_body) + + # return_type + return_type = opts[:debug_return_type] || 'VouchersUpdateResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.update_voucher", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#update_voucher\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Add or Remove Voucher Balance # Add balance to an existing gift card or loyalty card. # @param code [String] A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. @@ -580,14 +882,6 @@ def update_voucher_balance(code, vouchers_balance_update_request_body, opts = {} if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VouchersApi.update_voucher_balance ...' end - # verify the required parameter 'code' is set - if @api_client.config.client_side_validation && code.nil? - fail ArgumentError, "Missing the required parameter 'code' when calling VouchersApi.update_voucher_balance" - end - # verify the required parameter 'vouchers_balance_update_request_body' is set - if @api_client.config.client_side_validation && vouchers_balance_update_request_body.nil? - fail ArgumentError, "Missing the required parameter 'vouchers_balance_update_request_body' when calling VouchersApi.update_voucher_balance" - end # resource path local_var_path = '/v1/vouchers/{code}/balance'.sub('{' + 'code' + '}', CGI.escape(code.to_s)) @@ -632,5 +926,133 @@ def update_voucher_balance(code, vouchers_balance_update_request_body, opts = {} end return data, status_code, headers end + + # Update Vouchers in Bulk + # Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. 🚧 Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + # @param vouchers_update_in_bulk_item_request_body [Array] List the codes to be updated with the metadata key/value pairs for that code. + # @param [Hash] opts the optional parameters + # @return [VouchersUpdateInBulkResponseBody] + def update_vouchers_in_bulk(vouchers_update_in_bulk_item_request_body, opts = {}) + data, _status_code, _headers = update_vouchers_in_bulk_with_http_info(vouchers_update_in_bulk_item_request_body, opts) + data + end + + # Update Vouchers in Bulk + # Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. 🚧 Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + # @param vouchers_update_in_bulk_item_request_body [Array] List the codes to be updated with the metadata key/value pairs for that code. + # @param [Hash] opts the optional parameters + # @return [Array<(VouchersUpdateInBulkResponseBody, Integer, Hash)>] VouchersUpdateInBulkResponseBody data, response status code and response headers + private def update_vouchers_in_bulk_with_http_info(vouchers_update_in_bulk_item_request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.update_vouchers_in_bulk ...' + end + # resource path + local_var_path = '/v1/vouchers/bulk/async' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(vouchers_update_in_bulk_item_request_body) + + # return_type + return_type = opts[:debug_return_type] || 'VouchersUpdateInBulkResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.update_vouchers_in_bulk", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#update_vouchers_in_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Vouchers' Metadata in Bulk + # Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + # @param vouchers_metadata_update_in_bulk_request_body [VouchersMetadataUpdateInBulkRequestBody] List the codes of the vouchers you would like to update with the metadata key/value pairs. + # @param [Hash] opts the optional parameters + # @return [VouchersMetadataUpdateInBulkResponseBody] + def update_vouchers_metadata_in_bulk(vouchers_metadata_update_in_bulk_request_body, opts = {}) + data, _status_code, _headers = update_vouchers_metadata_in_bulk_with_http_info(vouchers_metadata_update_in_bulk_request_body, opts) + data + end + + # Update Vouchers' Metadata in Bulk + # Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + # @param vouchers_metadata_update_in_bulk_request_body [VouchersMetadataUpdateInBulkRequestBody] List the codes of the vouchers you would like to update with the metadata key/value pairs. + # @param [Hash] opts the optional parameters + # @return [Array<(VouchersMetadataUpdateInBulkResponseBody, Integer, Hash)>] VouchersMetadataUpdateInBulkResponseBody data, response status code and response headers + private def update_vouchers_metadata_in_bulk_with_http_info(vouchers_metadata_update_in_bulk_request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VouchersApi.update_vouchers_metadata_in_bulk ...' + end + # resource path + local_var_path = '/v1/vouchers/metadata/async' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(vouchers_metadata_update_in_bulk_request_body) + + # return_type + return_type = opts[:debug_return_type] || 'VouchersMetadataUpdateInBulkResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] + + new_options = opts.merge( + :operation => :"VouchersApi.update_vouchers_metadata_in_bulk", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VouchersApi#update_vouchers_metadata_in_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/VoucherifySdk/models/access_settings_campaign_assignments_list.rb b/lib/VoucherifySdk/models/access_settings_campaign_assignments_list.rb new file mode 100644 index 00000000..edca4c2c --- /dev/null +++ b/lib/VoucherifySdk/models/access_settings_campaign_assignments_list.rb @@ -0,0 +1,280 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Lists all assignments of the campaign to areas and stores if the Areas and Stores feature is enabled (Enterprise feature). + class AccessSettingsCampaignAssignmentsList + # The type of the object represented by JSON. Default is `list`. This object stores information about campaign assignments to areas and stores + attr_accessor :object + + # Identifies the name of the attribute that contains the array of campaign assignments. + attr_accessor :data_ref + + # Contains an array of campaign assignments. + attr_accessor :data + + # Total number of areas and stores to which the campaign is assigned. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@total.nil? && @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + data_ref_validator = EnumAttributeValidator.new('String', ["data"]) + return false unless data_ref_validator.valid?(@data_ref) + return false if !@total.nil? && @total < 0 + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/any.rb b/lib/VoucherifySdk/models/any.rb deleted file mode 100644 index 0454e9c3..00000000 --- a/lib/VoucherifySdk/models/any.rb +++ /dev/null @@ -1,107 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module Any - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'Array', - :'Float', - :'Object', - :'String' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/applicable_to.rb b/lib/VoucherifySdk/models/applicable_to.rb index 09016d80..296c62ca 100644 --- a/lib/VoucherifySdk/models/applicable_to.rb +++ b/lib/VoucherifySdk/models/applicable_to.rb @@ -54,6 +54,12 @@ class ApplicableTo attr_accessor :order_item_indices + attr_accessor :repeat + + attr_accessor :skip_initially + + attr_accessor :target + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -92,7 +98,10 @@ def self.attribute_map :'aggregated_quantity_limit' => :'aggregated_quantity_limit', :'amount_limit' => :'amount_limit', :'aggregated_amount_limit' => :'aggregated_amount_limit', - :'order_item_indices' => :'order_item_indices' + :'order_item_indices' => :'order_item_indices', + :'repeat' => :'repeat', + :'skip_initially' => :'skip_initially', + :'target' => :'target' } end @@ -117,41 +126,49 @@ def self.openapi_types :'aggregated_quantity_limit' => :'Integer', :'amount_limit' => :'Integer', :'aggregated_amount_limit' => :'Integer', - :'order_item_indices' => :'Array' + :'order_item_indices' => :'Array', + :'repeat' => :'Integer', + :'skip_initially' => :'Integer', + :'target' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'id', + :'source_id', + :'product_id', + :'product_source_id', + :'strict', + :'price', + :'price_formula', + :'quantity_limit', + :'aggregated_quantity_limit', + :'amount_limit', + :'aggregated_amount_limit', + :'order_item_indices', + :'repeat', + :'skip_initially', + :'target' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ApplicableTo` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ApplicableTo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'object') self.object = attributes[:'object'] - else - self.object = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') @@ -168,8 +185,6 @@ def initialize(attributes = {}) if attributes.key?(:'strict') self.strict = attributes[:'strict'] - else - self.strict = nil end if attributes.key?(:'price') @@ -207,25 +222,25 @@ def initialize(attributes = {}) self.order_item_indices = value end end - end - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') + if attributes.key?(:'repeat') + self.repeat = attributes[:'repeat'] end - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') + if attributes.key?(:'skip_initially') + self.skip_initially = attributes[:'skip_initially'] end - if @strict.nil? - invalid_properties.push('invalid value for "strict", strict cannot be nil.') + if attributes.key?(:'target') + self.target = attributes[:'target'] end + end + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new if @effect.nil? invalid_properties.push('invalid value for "effect", effect cannot be nil.') end @@ -237,25 +252,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product", "sku", "products_collection"]) return false unless object_validator.valid?(@object) - return false if @id.nil? - return false if @strict.nil? return false if @effect.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product", "sku", "products_collection"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -274,7 +276,10 @@ def ==(o) aggregated_quantity_limit == o.aggregated_quantity_limit && amount_limit == o.amount_limit && aggregated_amount_limit == o.aggregated_amount_limit && - order_item_indices == o.order_item_indices + order_item_indices == o.order_item_indices && + repeat == o.repeat && + skip_initially == o.skip_initially && + target == o.target end # @see the `==` method @@ -286,7 +291,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [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].hash + [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 end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/applicable_to_result_list.rb b/lib/VoucherifySdk/models/applicable_to_result_list.rb index 328f7118..409f12c9 100644 --- a/lib/VoucherifySdk/models/applicable_to_result_list.rb +++ b/lib/VoucherifySdk/models/applicable_to_result_list.rb @@ -21,10 +21,10 @@ class ApplicableToResultList # Total number of objects defining included products, SKUs, or product collections. attr_accessor :total - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :data_ref class EnumAttributeValidator @@ -77,21 +77,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'data', + :'total', + :'object', + :'data_ref' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ApplicableToResultList` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ApplicableToResultList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -99,14 +96,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'object') @@ -127,26 +120,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @total < 0 + if !@total.nil? && @total < 0 invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') end - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - invalid_properties end @@ -154,52 +131,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @data.nil? - return false if @total.nil? - return false if @total < 0 - return false if @object.nil? + return false if !@total.nil? && @total < 0 object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) true end - # Custom attribute writer method with validation - # @param [Object] total Value to be assigned - def total=(total) - if total.nil? - fail ArgumentError, 'total cannot be nil' - end - - if total < 0 - fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' - end - - @total = total - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/area_store_campaign_assignment.rb b/lib/VoucherifySdk/models/area_store_campaign_assignment.rb new file mode 100644 index 00000000..9648e451 --- /dev/null +++ b/lib/VoucherifySdk/models/area_store_campaign_assignment.rb @@ -0,0 +1,280 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # An object representing an assignment of a campaign to an area or store. + class AreaStoreCampaignAssignment + # Unique identifier of the campaign assignment. + attr_accessor :id + + # Unique identifier of the area to which the campaign is assigned. + attr_accessor :area_id + + # Unique identifier of the store to which the campaign is assigned. + attr_accessor :area_store_id + + # Date and time when the assignment was made. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # The type of the object represented by JSON. This object stores information about the campaign assignment to areas or stores. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'area_id' => :'area_id', + :'area_store_id' => :'area_store_id', + :'created_at' => :'created_at', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'area_id' => :'String', + :'area_store_id' => :'String', + :'created_at' => :'Time', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'area_id', + :'area_store_id', + :'created_at', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'area_id') + self.area_id = attributes[:'area_id'] + end + + if attributes.key?(:'area_store_id') + self.area_store_id = attributes[:'area_store_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'area_store_campaign_assignment' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["area_store_campaign_assignment"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + area_id == o.area_id && + area_store_id == o.area_store_id && + created_at == o.created_at && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, area_id, area_store_id, created_at, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/array_inner.rb b/lib/VoucherifySdk/models/array_inner.rb deleted file mode 100644 index 16bcdede..00000000 --- a/lib/VoucherifySdk/models/array_inner.rb +++ /dev/null @@ -1,106 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module ArrayInner - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'Float', - :'Object', - :'String' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/async_action_base.rb b/lib/VoucherifySdk/models/async_action_base.rb new file mode 100644 index 00000000..fe8d1d6c --- /dev/null +++ b/lib/VoucherifySdk/models/async_action_base.rb @@ -0,0 +1,347 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This is an object representing an asynchronous action. + class AsyncActionBase + # Async action unique ID. + attr_accessor :id + + # Type of async action. + attr_accessor :type + + # Status of the async action. Informs you whether the async action has already been completed. + attr_accessor :status + + # Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. + attr_accessor :operation_status + + # Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Unique request ID. + attr_accessor :request_id + + # The length of time it took to process the request in milliseconds. + attr_accessor :processing_time + + # % progress to completion of the asynchronous action. + attr_accessor :progress + + # The type of the object represented by JSON. This object stores information about the `async_action`. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type', + :'status' => :'status', + :'operation_status' => :'operation_status', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'request_id' => :'request_id', + :'processing_time' => :'processing_time', + :'progress' => :'progress', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String', + :'status' => :'String', + :'operation_status' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'request_id' => :'String', + :'processing_time' => :'Integer', + :'progress' => :'Integer', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type', + :'status', + :'operation_status', + :'created_at', + :'updated_at', + :'request_id', + :'processing_time', + :'progress', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'operation_status') + self.operation_status = attributes[:'operation_status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'processing_time') + self.processing_time = attributes[:'processing_time'] + end + + if attributes.key?(:'progress') + self.progress = attributes[:'progress'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'async_action' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@progress.nil? && @progress > 100 + invalid_properties.push('invalid value for "progress", must be smaller than or equal to 100.') + end + + if !@progress.nil? && @progress < 0 + invalid_properties.push('invalid value for "progress", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["DONE", "ENQUEUED", "FAILED", "IN_PROGRESS"]) + return false unless status_validator.valid?(@status) + return false if !@progress.nil? && @progress > 100 + return false if !@progress.nil? && @progress < 0 + object_validator = EnumAttributeValidator.new('String', ["async_action"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + status == o.status && + operation_status == o.operation_status && + created_at == o.created_at && + updated_at == o.updated_at && + request_id == o.request_id && + processing_time == o.processing_time && + progress == o.progress && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type, status, operation_status, created_at, updated_at, request_id, processing_time, progress, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/async_action_get_response_body.rb b/lib/VoucherifySdk/models/async_action_get_response_body.rb new file mode 100644 index 00000000..a970da38 --- /dev/null +++ b/lib/VoucherifySdk/models/async_action_get_response_body.rb @@ -0,0 +1,357 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/async-actions/{asyncActionId}`. + class AsyncActionGetResponseBody + # Async action unique ID. + attr_accessor :id + + # Type of async action. + attr_accessor :type + + # Status of the async action. Informs you whether the async action has already been completed. + attr_accessor :status + + # Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. + attr_accessor :operation_status + + # Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Unique request ID. + attr_accessor :request_id + + # The length of time it took to process the request in milliseconds. + attr_accessor :processing_time + + # % progress to completion of the asynchronous action. + attr_accessor :progress + + # The type of the object represented by JSON. This object stores information about the `async_action`. + attr_accessor :object + + attr_accessor :result + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type', + :'status' => :'status', + :'operation_status' => :'operation_status', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'request_id' => :'request_id', + :'processing_time' => :'processing_time', + :'progress' => :'progress', + :'object' => :'object', + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String', + :'status' => :'String', + :'operation_status' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'request_id' => :'String', + :'processing_time' => :'Integer', + :'progress' => :'Integer', + :'object' => :'String', + :'result' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type', + :'status', + :'operation_status', + :'created_at', + :'updated_at', + :'request_id', + :'processing_time', + :'progress', + :'object', + :'result' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'operation_status') + self.operation_status = attributes[:'operation_status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'processing_time') + self.processing_time = attributes[:'processing_time'] + end + + if attributes.key?(:'progress') + self.progress = attributes[:'progress'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'async_action' + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@progress.nil? && @progress > 100 + invalid_properties.push('invalid value for "progress", must be smaller than or equal to 100.') + end + + if !@progress.nil? && @progress < 0 + invalid_properties.push('invalid value for "progress", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["DONE", "ENQUEUED", "FAILED", "IN_PROGRESS"]) + return false unless status_validator.valid?(@status) + return false if !@progress.nil? && @progress > 100 + return false if !@progress.nil? && @progress < 0 + object_validator = EnumAttributeValidator.new('String', ["async_action"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + status == o.status && + operation_status == o.operation_status && + created_at == o.created_at && + updated_at == o.updated_at && + request_id == o.request_id && + processing_time == o.processing_time && + progress == o.progress && + object == o.object && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type, status, operation_status, created_at, updated_at, request_id, processing_time, progress, object, result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/async_actions.rb b/lib/VoucherifySdk/models/async_actions.rb deleted file mode 100644 index f12d63f8..00000000 --- a/lib/VoucherifySdk/models/async_actions.rb +++ /dev/null @@ -1,223 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response to requests that are processed asynchronously. - class AsyncActions - # The ID of the scheduled asynchronous action. - attr_accessor :async_action_id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'async_action_id' => :'async_action_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'async_action_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::AsyncActions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::AsyncActions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'async_action_id') - self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - async_action_id == o.async_action_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [async_action_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/async_actions_list_response_body.rb b/lib/VoucherifySdk/models/async_actions_list_response_body.rb new file mode 100644 index 00000000..34ab569a --- /dev/null +++ b/lib/VoucherifySdk/models/async_actions_list_response_body.rb @@ -0,0 +1,263 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/async-actions`. + class AsyncActionsListResponseBody + # The type of the object represented by JSON. This object stores information about asynchronous actions. + attr_accessor :object + + # Identifies the name of the JSON property that contains the array of asynchronous actions. + attr_accessor :data_ref + + attr_accessor :async_actions + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'async_actions' => :'async_actions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'async_actions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'async_actions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'async_actions' + end + + if attributes.key?(:'async_actions') + if (value = attributes[:'async_actions']).is_a?(Array) + self.async_actions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + data_ref_validator = EnumAttributeValidator.new('String', ["async_actions"]) + return false unless data_ref_validator.valid?(@data_ref) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + async_actions == o.async_actions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, async_actions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/bus_val_rule_assignment.rb b/lib/VoucherifySdk/models/bus_val_rule_assignment.rb index 03f18bc7..2fc1ef88 100644 --- a/lib/VoucherifySdk/models/bus_val_rule_assignment.rb +++ b/lib/VoucherifySdk/models/bus_val_rule_assignment.rb @@ -28,13 +28,13 @@ class BusValRuleAssignment # The type of related object attr_accessor :related_object_type - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp representing the date and time when the object was last updated in ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # The validation status of the assignment @@ -103,46 +103,40 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'rule_id', + :'related_object_id', + :'related_object_type', + :'created_at', + :'updated_at', + :'object', + :'validation_status', + :'validation_omitted_rules' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::BusValRuleAssignment` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::BusValRuleAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'rule_id') self.rule_id = attributes[:'rule_id'] - else - self.rule_id = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'created_at') @@ -175,26 +169,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @rule_id.nil? - invalid_properties.push('invalid value for "rule_id", rule_id cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -202,11 +176,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @rule_id.nil? - return false if @related_object_id.nil? - return false if @related_object_type.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["validation_rules_assignment"]) return false unless object_validator.valid?(@object) validation_status_validator = EnumAttributeValidator.new('String', ["VALID", "PARTIALLY_VALID", "INVALID"]) @@ -214,26 +183,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["validation_rules_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] validation_status Object to be assigned - def validation_status=(validation_status) - validator = EnumAttributeValidator.new('String', ["VALID", "PARTIALLY_VALID", "INVALID"]) - unless validator.valid?(validation_status) - fail ArgumentError, "invalid value for \"validation_status\", must be one of #{validator.allowable_values}." - end - @validation_status = validation_status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/campaign.rb b/lib/VoucherifySdk/models/campaign.rb deleted file mode 100644 index 5290a4c8..00000000 --- a/lib/VoucherifySdk/models/campaign.rb +++ /dev/null @@ -1,674 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class Campaign - # Unique campaign ID, assigned by Voucherify. - attr_accessor :id - - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Type of campaign. - attr_accessor :campaign_type - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published - attr_accessor :type - - attr_accessor :voucher - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Total number of unique vouchers in campaign. - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - # A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign - attr_accessor :active - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Timestamp representing the date and time when the campaign was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the voucher was updated in ISO 8601 format. - attr_accessor :updated_at - - # Unique category name. - attr_accessor :category - - # Indicates the status of the campaign creation. - attr_accessor :creation_status - - # Indicates the status of the campaign's vouchers. - attr_accessor :vouchers_generation_status - - # Indicates whether the resource can be deleted. - attr_accessor :protected - - # Unique category ID that this campaign belongs to. - attr_accessor :category_id - - # Contains details about the category. - attr_accessor :categories - - # The type of object represented by JSON. This object stores information about the campaign. - attr_accessor :object - - attr_accessor :referral_program - - attr_accessor :loyalty_tiers_expiration - - attr_accessor :promotion - - attr_accessor :validation_rules_assignments - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'name' => :'name', - :'description' => :'description', - :'campaign_type' => :'campaign_type', - :'type' => :'type', - :'voucher' => :'voucher', - :'auto_join' => :'auto_join', - :'join_once' => :'join_once', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'active' => :'active', - :'metadata' => :'metadata', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'category' => :'category', - :'creation_status' => :'creation_status', - :'vouchers_generation_status' => :'vouchers_generation_status', - :'protected' => :'protected', - :'category_id' => :'category_id', - :'categories' => :'categories', - :'object' => :'object', - :'referral_program' => :'referral_program', - :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', - :'promotion' => :'promotion', - :'validation_rules_assignments' => :'validation_rules_assignments' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'name' => :'String', - :'description' => :'String', - :'campaign_type' => :'String', - :'type' => :'String', - :'voucher' => :'CampaignVoucher', - :'auto_join' => :'Boolean', - :'join_once' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'active' => :'Boolean', - :'metadata' => :'Object', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'category' => :'String', - :'creation_status' => :'String', - :'vouchers_generation_status' => :'String', - :'protected' => :'Boolean', - :'category_id' => :'String', - :'categories' => :'Array', - :'object' => :'String', - :'referral_program' => :'ReferralProgram', - :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', - :'promotion' => :'PromotionTiersList', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'category_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Campaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Campaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - else - self.name = nil - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = nil - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = nil - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - else - self.auto_join = nil - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - else - self.join_once = nil - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - else - self.use_voucher_metadata_schema = nil - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'active') - self.active = attributes[:'active'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'creation_status') - self.creation_status = attributes[:'creation_status'] - else - self.creation_status = nil - end - - if attributes.key?(:'vouchers_generation_status') - self.vouchers_generation_status = attributes[:'vouchers_generation_status'] - else - self.vouchers_generation_status = nil - end - - if attributes.key?(:'protected') - self.protected = attributes[:'protected'] - else - self.protected = nil - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - else - self.category_id = nil - end - - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - else - self.categories = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'campaign' - end - - if attributes.key?(:'referral_program') - self.referral_program = attributes[:'referral_program'] - end - - if attributes.key?(:'loyalty_tiers_expiration') - self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] - end - - if attributes.key?(:'promotion') - self.promotion = attributes[:'promotion'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @campaign_type.nil? - invalid_properties.push('invalid value for "campaign_type", campaign_type cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @auto_join.nil? - invalid_properties.push('invalid value for "auto_join", auto_join cannot be nil.') - end - - if @join_once.nil? - invalid_properties.push('invalid value for "join_once", join_once cannot be nil.') - end - - if @use_voucher_metadata_schema.nil? - invalid_properties.push('invalid value for "use_voucher_metadata_schema", use_voucher_metadata_schema cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @creation_status.nil? - invalid_properties.push('invalid value for "creation_status", creation_status cannot be nil.') - end - - if @vouchers_generation_status.nil? - invalid_properties.push('invalid value for "vouchers_generation_status", vouchers_generation_status cannot be nil.') - end - - if @protected.nil? - invalid_properties.push('invalid value for "protected", protected cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @campaign_type.nil? - campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) - return false unless campaign_type_validator.valid?(@campaign_type) - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if @auto_join.nil? - return false if @join_once.nil? - return false if @use_voucher_metadata_schema.nil? - return false if @created_at.nil? - return false if @creation_status.nil? - creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - return false unless creation_status_validator.valid?(@creation_status) - return false if @vouchers_generation_status.nil? - vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) - return false if @protected.nil? - return false if @categories.nil? - return false if @object.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] creation_status Object to be assigned - def creation_status=(creation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(creation_status) - fail ArgumentError, "invalid value for \"creation_status\", must be one of #{validator.allowable_values}." - end - @creation_status = creation_status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] vouchers_generation_status Object to be assigned - def vouchers_generation_status=(vouchers_generation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(vouchers_generation_status) - fail ArgumentError, "invalid value for \"vouchers_generation_status\", must be one of #{validator.allowable_values}." - end - @vouchers_generation_status = vouchers_generation_status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - name == o.name && - description == o.description && - campaign_type == o.campaign_type && - type == o.type && - voucher == o.voucher && - auto_join == o.auto_join && - join_once == o.join_once && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - active == o.active && - metadata == o.metadata && - created_at == o.created_at && - updated_at == o.updated_at && - category == o.category && - creation_status == o.creation_status && - vouchers_generation_status == o.vouchers_generation_status && - protected == o.protected && - category_id == o.category_id && - categories == o.categories && - object == o.object && - referral_program == o.referral_program && - loyalty_tiers_expiration == o.loyalty_tiers_expiration && - promotion == o.promotion && - validation_rules_assignments == o.validation_rules_assignments - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaign_base.rb b/lib/VoucherifySdk/models/campaign_base.rb index b6b815b1..a8f029ea 100644 --- a/lib/VoucherifySdk/models/campaign_base.rb +++ b/lib/VoucherifySdk/models/campaign_base.rb @@ -44,10 +44,12 @@ class CampaignBase attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :validity_hours + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. attr_accessor :activity_duration_after_publishing # Total number of unique vouchers in campaign. @@ -65,10 +67,10 @@ class CampaignBase # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the campaign was created in ISO 8601 format. + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the voucher was updated in ISO 8601 format. + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. attr_accessor :updated_at # Unique category name. @@ -77,7 +79,7 @@ class CampaignBase # Indicates the status of the campaign creation. attr_accessor :creation_status - # Indicates the status of the campaign's vouchers. + # Indicates the status of the campaign's voucher generation. attr_accessor :vouchers_generation_status # Indicates whether the resource can be deleted. @@ -89,7 +91,7 @@ class CampaignBase # Contains details about the category. attr_accessor :categories - # The type of object represented by JSON. This object stores information about the campaign. + # The type of the object represented by JSON. This object stores information about the campaign. attr_accessor :object attr_accessor :referral_program @@ -132,6 +134,7 @@ def self.attribute_map :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'activity_duration_after_publishing' => :'activity_duration_after_publishing', :'vouchers_count' => :'vouchers_count', :'start_date' => :'start_date', @@ -169,8 +172,9 @@ def self.openapi_types :'auto_join' => :'Boolean', :'join_once' => :'Boolean', :'use_voucher_metadata_schema' => :'Boolean', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'activity_duration_after_publishing' => :'String', :'vouchers_count' => :'Integer', :'start_date' => :'Time', @@ -194,35 +198,46 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', :'category_id', + :'categories', + :'object', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignBase` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'description') @@ -231,14 +246,10 @@ def initialize(attributes = {}) if attributes.key?(:'campaign_type') self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'voucher') @@ -247,20 +258,14 @@ def initialize(attributes = {}) if attributes.key?(:'auto_join') self.auto_join = attributes[:'auto_join'] - else - self.auto_join = nil end if attributes.key?(:'join_once') self.join_once = attributes[:'join_once'] - else - self.join_once = nil end if attributes.key?(:'use_voucher_metadata_schema') self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - else - self.use_voucher_metadata_schema = nil end if attributes.key?(:'validity_timeframe') @@ -273,6 +278,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'activity_duration_after_publishing') self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] end @@ -299,8 +308,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -313,34 +320,24 @@ def initialize(attributes = {}) if attributes.key?(:'creation_status') self.creation_status = attributes[:'creation_status'] - else - self.creation_status = nil end if attributes.key?(:'vouchers_generation_status') self.vouchers_generation_status = attributes[:'vouchers_generation_status'] - else - self.vouchers_generation_status = nil end if attributes.key?(:'protected') self.protected = attributes[:'protected'] - else - self.protected = nil end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end if attributes.key?(:'object') @@ -363,58 +360,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @campaign_type.nil? - invalid_properties.push('invalid value for "campaign_type", campaign_type cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @auto_join.nil? - invalid_properties.push('invalid value for "auto_join", auto_join cannot be nil.') - end - - if @join_once.nil? - invalid_properties.push('invalid value for "join_once", join_once cannot be nil.') - end - - if @use_voucher_metadata_schema.nil? - invalid_properties.push('invalid value for "use_voucher_metadata_schema", use_voucher_metadata_schema cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @creation_status.nil? - invalid_properties.push('invalid value for "creation_status", creation_status cannot be nil.') - end - - if @vouchers_generation_status.nil? - invalid_properties.push('invalid value for "vouchers_generation_status", vouchers_generation_status cannot be nil.') - end - - if @protected.nil? - invalid_properties.push('invalid value for "protected", protected cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -422,70 +367,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @campaign_type.nil? campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) return false unless campaign_type_validator.valid?(@campaign_type) - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) return false unless type_validator.valid?(@type) - return false if @auto_join.nil? - return false if @join_once.nil? - return false if @use_voucher_metadata_schema.nil? - return false if @created_at.nil? - return false if @creation_status.nil? creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless creation_status_validator.valid?(@creation_status) - return false if @vouchers_generation_status.nil? vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) - return false if @protected.nil? - return false if @categories.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] creation_status Object to be assigned - def creation_status=(creation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(creation_status) - fail ArgumentError, "invalid value for \"creation_status\", must be one of #{validator.allowable_values}." - end - @creation_status = creation_status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] vouchers_generation_status Object to be assigned - def vouchers_generation_status=(vouchers_generation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(vouchers_generation_status) - fail ArgumentError, "invalid value for \"vouchers_generation_status\", must be one of #{validator.allowable_values}." - end - @vouchers_generation_status = vouchers_generation_status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -502,6 +394,7 @@ def ==(o) use_voucher_metadata_schema == o.use_voucher_metadata_schema && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && activity_duration_after_publishing == o.activity_duration_after_publishing && vouchers_count == o.vouchers_count && start_date == o.start_date && @@ -530,7 +423,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration].hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaign_base_validity_timeframe.rb b/lib/VoucherifySdk/models/campaign_base_validity_timeframe.rb deleted file mode 100644 index d685fe5d..00000000 --- a/lib/VoucherifySdk/models/campaign_base_validity_timeframe.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`. - class CampaignBaseValidityTimeframe - # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day. - attr_accessor :interval - - # Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day. - attr_accessor :duration - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'interval' => :'interval', - :'duration' => :'duration' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'interval' => :'String', - :'duration' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignBaseValidityTimeframe` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignBaseValidityTimeframe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'interval') - self.interval = attributes[:'interval'] - end - - if attributes.key?(:'duration') - self.duration = attributes[:'duration'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - interval == o.interval && - duration == o.duration - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [interval, duration].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaign_loyalty_card.rb b/lib/VoucherifySdk/models/campaign_loyalty_card.rb index ed91af53..086112fa 100644 --- a/lib/VoucherifySdk/models/campaign_loyalty_card.rb +++ b/lib/VoucherifySdk/models/campaign_loyalty_card.rb @@ -45,28 +45,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'expiration_rules' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignLoyaltyCard` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'expiration_rules') @@ -79,10 +72,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - invalid_properties end @@ -90,7 +79,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? true end diff --git a/lib/VoucherifySdk/models/campaign_loyalty_card_expiration_rules.rb b/lib/VoucherifySdk/models/campaign_loyalty_card_expiration_rules.rb index b0a362cf..48acb116 100644 --- a/lib/VoucherifySdk/models/campaign_loyalty_card_expiration_rules.rb +++ b/lib/VoucherifySdk/models/campaign_loyalty_card_expiration_rules.rb @@ -27,6 +27,28 @@ class CampaignLoyaltyCardExpirationRules # Value of rounding attr_accessor :rounding_value + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -55,46 +77,37 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'period_type', + :'period_value', + :'rounding_type', + :'rounding_value' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignLoyaltyCardExpirationRules` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignLoyaltyCardExpirationRules`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'period_type') self.period_type = attributes[:'period_type'] else - self.period_type = nil + self.period_type = 'MONTH' end if attributes.key?(:'period_value') self.period_value = attributes[:'period_value'] - else - self.period_value = nil end if attributes.key?(:'rounding_type') self.rounding_type = attributes[:'rounding_type'] - else - self.rounding_type = nil end if attributes.key?(:'rounding_value') self.rounding_value = attributes[:'rounding_value'] - else - self.rounding_value = nil end end @@ -103,22 +116,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @period_type.nil? - invalid_properties.push('invalid value for "period_type", period_type cannot be nil.') - end - - if @period_value.nil? - invalid_properties.push('invalid value for "period_value", period_value cannot be nil.') - end - - if @rounding_type.nil? - invalid_properties.push('invalid value for "rounding_type", rounding_type cannot be nil.') - end - - if @rounding_value.nil? - invalid_properties.push('invalid value for "rounding_value", rounding_value cannot be nil.') - end - invalid_properties end @@ -126,10 +123,10 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @period_type.nil? - return false if @period_value.nil? - return false if @rounding_type.nil? - return false if @rounding_value.nil? + period_type_validator = EnumAttributeValidator.new('String', ["MONTH"]) + return false unless period_type_validator.valid?(@period_type) + rounding_type_validator = EnumAttributeValidator.new('String', ["END_OF_MONTH", "END_OF_QUARTER", "END_OF_HALF_YEAR", "END_OF_YEAR", "PARTICULAR_MONTH"]) + return false unless rounding_type_validator.valid?(@rounding_type) true end diff --git a/lib/VoucherifySdk/models/campaign_loyalty_voucher.rb b/lib/VoucherifySdk/models/campaign_loyalty_voucher.rb index 5a3933fb..6b6009ad 100644 --- a/lib/VoucherifySdk/models/campaign_loyalty_voucher.rb +++ b/lib/VoucherifySdk/models/campaign_loyalty_voucher.rb @@ -75,21 +75,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'redemption', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignLoyaltyVoucher` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignLoyaltyVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -119,10 +114,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - if @loyalty_card.nil? invalid_properties.push('invalid value for "loyalty_card", loyalty_card cannot be nil.') end @@ -134,23 +125,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) return false unless type_validator.valid?(@type) return false if @loyalty_card.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/campaign_loyalty_voucher_redemption.rb b/lib/VoucherifySdk/models/campaign_loyalty_voucher_redemption.rb index f7175ddd..ce046e27 100644 --- a/lib/VoucherifySdk/models/campaign_loyalty_voucher_redemption.rb +++ b/lib/VoucherifySdk/models/campaign_loyalty_voucher_redemption.rb @@ -48,15 +48,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignLoyaltyVoucherRedemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignLoyaltyVoucherRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/campaign_voucher.rb b/lib/VoucherifySdk/models/campaign_voucher.rb index dbe1bc2f..cf791e58 100644 --- a/lib/VoucherifySdk/models/campaign_voucher.rb +++ b/lib/VoucherifySdk/models/campaign_voucher.rb @@ -40,6 +40,33 @@ class CampaignVoucher attr_accessor :validity_timeframe + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -52,7 +79,9 @@ def self.attribute_map :'is_referral_code' => :'is_referral_code', :'start_date' => :'start_date', :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe' + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours' } end @@ -69,39 +98,37 @@ def self.openapi_types :'gift' => :'Gift', :'loyalty_card' => :'CampaignLoyaltyCard', :'redemption' => :'CampaignVoucherRedemption', - :'code_config' => :'CodeConfigRequiredLengthCharsetPattern', + :'code_config' => :'CodeConfig', :'is_referral_code' => :'Boolean', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe' + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'redemption', + :'is_referral_code', + :'start_date', + :'expiration_date', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignVoucher` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = 'DISCOUNT_VOUCHER' end if attributes.key?(:'discount') @@ -118,8 +145,6 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] - else - self.redemption = nil end if attributes.key?(:'code_config') @@ -130,8 +155,6 @@ def initialize(attributes = {}) if attributes.key?(:'is_referral_code') self.is_referral_code = attributes[:'is_referral_code'] - else - self.is_referral_code = nil end if attributes.key?(:'start_date') @@ -145,6 +168,16 @@ def initialize(attributes = {}) if attributes.key?(:'validity_timeframe') self.validity_timeframe = attributes[:'validity_timeframe'] end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -152,22 +185,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @redemption.nil? - invalid_properties.push('invalid value for "redemption", redemption cannot be nil.') - end - if @code_config.nil? invalid_properties.push('invalid value for "code_config", code_config cannot be nil.') end - if @is_referral_code.nil? - invalid_properties.push('invalid value for "is_referral_code", is_referral_code cannot be nil.') - end - invalid_properties end @@ -175,10 +196,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - return false if @redemption.nil? return false if @code_config.nil? - return false if @is_referral_code.nil? true end @@ -196,7 +214,9 @@ def ==(o) is_referral_code == o.is_referral_code && start_date == o.start_date && expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours end # @see the `==` method @@ -208,7 +228,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, discount, gift, loyalty_card, redemption, code_config, is_referral_code, start_date, expiration_date, validity_timeframe].hash + [type, discount, gift, loyalty_card, redemption, code_config, is_referral_code, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaign_voucher_redemption.rb b/lib/VoucherifySdk/models/campaign_voucher_redemption.rb index 2e39f387..b3087f3c 100644 --- a/lib/VoucherifySdk/models/campaign_voucher_redemption.rb +++ b/lib/VoucherifySdk/models/campaign_voucher_redemption.rb @@ -48,22 +48,13 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignVoucherRedemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignVoucherRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] - else - self.quantity = nil end end diff --git a/lib/VoucherifySdk/models/campaigns_create_base.rb b/lib/VoucherifySdk/models/campaigns_create_base.rb deleted file mode 100644 index 165d98f0..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_base.rb +++ /dev/null @@ -1,422 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Base body schema for creating a campaign using **POST** `/campaigns`. - class CampaignsCreateBase - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_discount_coupons_campaign.rb b/lib/VoucherifySdk/models/campaigns_create_discount_coupons_campaign.rb deleted file mode 100644 index fd98a0a1..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_discount_coupons_campaign.rb +++ /dev/null @@ -1,461 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsCreateDiscountCouponsCampaign - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Type of campaign. - attr_accessor :campaign_type - - attr_accessor :voucher - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata', - :'campaign_type' => :'campaign_type', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'campaign_type' => :'String', - :'voucher' => :'DiscountCouponsCampaignVoucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsCreateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateDiscountCouponsCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateDiscountCouponsCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = 'DISCOUNT_COUPONS' - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - campaign_type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_COUPONS"]) - return false unless campaign_type_validator.valid?(@campaign_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_COUPONS"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata && - campaign_type == o.campaign_type && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_gift_campaign.rb b/lib/VoucherifySdk/models/campaigns_create_gift_campaign.rb deleted file mode 100644 index 08aec94b..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_gift_campaign.rb +++ /dev/null @@ -1,461 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsCreateGiftCampaign - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Type of campaign. - attr_accessor :campaign_type - - attr_accessor :voucher - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata', - :'campaign_type' => :'campaign_type', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'campaign_type' => :'String', - :'voucher' => :'GiftCampaignVoucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsCreateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateGiftCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateGiftCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = 'GIFT_VOUCHERS' - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - campaign_type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHERS"]) - return false unless campaign_type_validator.valid?(@campaign_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHERS"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata && - campaign_type == o.campaign_type && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_giveaway_campaign.rb b/lib/VoucherifySdk/models/campaigns_create_giveaway_campaign.rb deleted file mode 100644 index 8ebefb5e..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_giveaway_campaign.rb +++ /dev/null @@ -1,470 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsCreateGiveawayCampaign - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Type of campaign. - attr_accessor :campaign_type - - attr_accessor :voucher - - attr_accessor :lucky_draw - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata', - :'campaign_type' => :'campaign_type', - :'voucher' => :'voucher', - :'lucky_draw' => :'lucky_draw' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'campaign_type' => :'String', - :'voucher' => :'GiveawayCampaignVoucher', - :'lucky_draw' => :'LuckyDraw' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsCreateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateGiveawayCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateGiveawayCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = 'LUCKY_DRAW' - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'lucky_draw') - self.lucky_draw = attributes[:'lucky_draw'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - campaign_type_validator = EnumAttributeValidator.new('String', ["LUCKY_DRAW"]) - return false unless campaign_type_validator.valid?(@campaign_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LUCKY_DRAW"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata && - campaign_type == o.campaign_type && - voucher == o.voucher && - lucky_draw == o.lucky_draw - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, voucher, lucky_draw].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_loyalty_campaign.rb b/lib/VoucherifySdk/models/campaigns_create_loyalty_campaign.rb deleted file mode 100644 index 583dbf1b..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_loyalty_campaign.rb +++ /dev/null @@ -1,461 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsCreateLoyaltyCampaign - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Type of campaign. - attr_accessor :campaign_type - - attr_accessor :voucher - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata', - :'campaign_type' => :'campaign_type', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'campaign_type' => :'String', - :'voucher' => :'CampaignLoyaltyVoucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsCreateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateLoyaltyCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateLoyaltyCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = 'LOYALTY_PROGRAM' - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) - return false unless campaign_type_validator.valid?(@campaign_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata && - campaign_type == o.campaign_type && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_promotion_campaign.rb b/lib/VoucherifySdk/models/campaigns_create_promotion_campaign.rb deleted file mode 100644 index 973890ed..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_promotion_campaign.rb +++ /dev/null @@ -1,461 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsCreatePromotionCampaign - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Type of campaign. - attr_accessor :campaign_type - - attr_accessor :promotion - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata', - :'campaign_type' => :'campaign_type', - :'promotion' => :'promotion' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'campaign_type' => :'String', - :'promotion' => :'SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsCreateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreatePromotionCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreatePromotionCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = 'PROMOTION' - end - - if attributes.key?(:'promotion') - self.promotion = attributes[:'promotion'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - campaign_type_validator = EnumAttributeValidator.new('String', ["PROMOTION"]) - return false unless campaign_type_validator.valid?(@campaign_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["PROMOTION"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata && - campaign_type == o.campaign_type && - promotion == o.promotion - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, promotion].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_referral_campaign.rb b/lib/VoucherifySdk/models/campaigns_create_referral_campaign.rb deleted file mode 100644 index 68186070..00000000 --- a/lib/VoucherifySdk/models/campaigns_create_referral_campaign.rb +++ /dev/null @@ -1,470 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsCreateReferralCampaign - # Campaign name. - attr_accessor :name - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. - attr_accessor :use_voucher_metadata_schema - - # Total number of unique vouchers in campaign (size of campaign). - attr_accessor :vouchers_count - - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # Array containing the ID of the validation rule associated with the promotion tier. - attr_accessor :validation_rules - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Type of campaign. - attr_accessor :campaign_type - - attr_accessor :referral_program - - attr_accessor :voucher - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'type' => :'type', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', - :'vouchers_count' => :'vouchers_count', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'validation_rules' => :'validation_rules', - :'category_id' => :'category_id', - :'category' => :'category', - :'metadata' => :'metadata', - :'campaign_type' => :'campaign_type', - :'referral_program' => :'referral_program', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'type' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'use_voucher_metadata_schema' => :'Boolean', - :'vouchers_count' => :'Integer', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'activity_duration_after_publishing' => :'String', - :'validation_rules' => :'Array', - :'category_id' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'campaign_type' => :'String', - :'referral_program' => :'ReferralProgram', - :'voucher' => :'ReferralCampaignVoucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsCreateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateReferralCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateReferralCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'use_voucher_metadata_schema') - self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - end - - if attributes.key?(:'vouchers_count') - self.vouchers_count = attributes[:'vouchers_count'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = 'REFERRAL_PROGRAM' - end - - if attributes.key?(:'referral_program') - self.referral_program = attributes[:'referral_program'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@validation_rules.nil? && @validation_rules.length > 1 - invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - return false if !@validation_rules.nil? && @validation_rules.length > 1 - campaign_type_validator = EnumAttributeValidator.new('String', ["REFERRAL_PROGRAM"]) - return false unless campaign_type_validator.valid?(@campaign_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] validation_rules Value to be assigned - def validation_rules=(validation_rules) - if validation_rules.nil? - fail ArgumentError, 'validation_rules cannot be nil' - end - - if validation_rules.length > 1 - fail ArgumentError, 'invalid value for "validation_rules", number of items must be less than or equal to 1.' - end - - @validation_rules = validation_rules - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["REFERRAL_PROGRAM"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - type == o.type && - join_once == o.join_once && - auto_join == o.auto_join && - use_voucher_metadata_schema == o.use_voucher_metadata_schema && - vouchers_count == o.vouchers_count && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - activity_duration_after_publishing == o.activity_duration_after_publishing && - validation_rules == o.validation_rules && - category_id == o.category_id && - category == o.category && - metadata == o.metadata && - campaign_type == o.campaign_type && - referral_program == o.referral_program && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, referral_program, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_create_request_body.rb b/lib/VoucherifySdk/models/campaigns_create_request_body.rb index 7a007fdf..272c9f4d 100644 --- a/lib/VoucherifySdk/models/campaigns_create_request_body.rb +++ b/lib/VoucherifySdk/models/campaigns_create_request_body.rb @@ -14,97 +14,449 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/campaigns`. - module CampaignsCreateRequestBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'CampaignsCreateDiscountCouponsCampaign', - :'CampaignsCreateGiftCampaign', - :'CampaignsCreateGiveawayCampaign', - :'CampaignsCreateLoyaltyCampaign', - :'CampaignsCreatePromotionCampaign', - :'CampaignsCreateReferralCampaign' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class CampaignsCreateRequestBody + # Campaign name. + attr_accessor :name + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + attr_accessor :type + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + attr_accessor :use_voucher_metadata_schema + + # Total number of unique vouchers in campaign (size of campaign). + attr_accessor :vouchers_count + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # Array containing the ID of the validation rule associated with the promotion tier. + attr_accessor :validation_rules + + # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + attr_accessor :category_id + + # The category assigned to the campaign. Either pass this parameter OR the `category_id`. + attr_accessor :category + + attr_accessor :metadata + + attr_accessor :campaign_type + + attr_accessor :voucher + + attr_accessor :referral_program + + attr_accessor :promotion + + attr_accessor :lucky_draw + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'type' => :'type', + :'join_once' => :'join_once', + :'auto_join' => :'auto_join', + :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', + :'vouchers_count' => :'vouchers_count', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'validation_rules' => :'validation_rules', + :'category_id' => :'category_id', + :'category' => :'category', + :'metadata' => :'metadata', + :'campaign_type' => :'campaign_type', + :'voucher' => :'voucher', + :'referral_program' => :'referral_program', + :'promotion' => :'promotion', + :'lucky_draw' => :'lucky_draw' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'description' => :'String', + :'type' => :'String', + :'join_once' => :'Boolean', + :'auto_join' => :'Boolean', + :'use_voucher_metadata_schema' => :'Boolean', + :'vouchers_count' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'activity_duration_after_publishing' => :'String', + :'validation_rules' => :'Array', + :'category_id' => :'String', + :'category' => :'String', + :'metadata' => :'Object', + :'campaign_type' => :'String', + :'voucher' => :'CampaignsCreateRequestBodyVoucher', + :'referral_program' => :'ReferralProgram', + :'promotion' => :'CampaignsCreateRequestBodyPromotion', + :'lucky_draw' => :'LuckyDraw' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'description', + :'type', + :'join_once', + :'auto_join', + :'use_voucher_metadata_schema', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'activity_duration_after_publishing', + :'validation_rules', + :'category_id', + :'category', + :'metadata', + :'campaign_type', + :'voucher', + :'promotion', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'use_voucher_metadata_schema') + self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] + end + + if attributes.key?(:'vouchers_count') + self.vouchers_count = attributes[:'vouchers_count'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'validation_rules') + if (value = attributes[:'validation_rules']).is_a?(Array) + self.validation_rules = value + end + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'referral_program') + self.referral_program = attributes[:'referral_program'] + end + + if attributes.key?(:'promotion') + self.promotion = attributes[:'promotion'] + end + + if attributes.key?(:'lucky_draw') + self.lucky_draw = attributes[:'lucky_draw'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@validation_rules.nil? && @validation_rules.length > 1 + invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + return false if !@validation_rules.nil? && @validation_rules.length > 1 + campaign_type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_COUPONS", "REFERRAL_PROGRAM", "GIFT_VOUCHERS", "LOYALTY_PROGRAM", "PROMOTION", "LUCKY_DRAW"]) + return false unless campaign_type_validator.valid?(@campaign_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + description == o.description && + type == o.type && + join_once == o.join_once && + auto_join == o.auto_join && + use_voucher_metadata_schema == o.use_voucher_metadata_schema && + vouchers_count == o.vouchers_count && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + activity_duration_after_publishing == o.activity_duration_after_publishing && + validation_rules == o.validation_rules && + category_id == o.category_id && + category == o.category && + metadata == o.metadata && + campaign_type == o.campaign_type && + voucher == o.voucher && + referral_program == o.referral_program && + promotion == o.promotion && + lucky_draw == o.lucky_draw + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, voucher, referral_program, promotion, lucky_draw].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/campaigns_create_request_body_promotion.rb b/lib/VoucherifySdk/models/campaigns_create_request_body_promotion.rb new file mode 100644 index 00000000..1e2081c3 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_create_request_body_promotion.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class CampaignsCreateRequestBodyPromotion + attr_accessor :tiers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'tiers' => :'tiers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'tiers' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'tiers' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'tiers') + if (value = attributes[:'tiers']).is_a?(Array) + self.tiers = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + tiers == o.tiers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [tiers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_create_request_body_voucher.rb b/lib/VoucherifySdk/models/campaigns_create_request_body_voucher.rb new file mode 100644 index 00000000..c18eac93 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_create_request_body_voucher.rb @@ -0,0 +1,289 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class CampaignsCreateRequestBodyVoucher + attr_accessor :type + + attr_accessor :discount + + attr_accessor :code_config + + attr_accessor :redemption + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + attr_accessor :gift + + attr_accessor :loyalty_card + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'discount' => :'discount', + :'code_config' => :'code_config', + :'redemption' => :'redemption', + :'is_referral_code' => :'is_referral_code', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'discount' => :'Discount', + :'code_config' => :'CodeConfig', + :'redemption' => :'CampaignsCreateRequestBodyVoucherRedemption', + :'is_referral_code' => :'Boolean', + :'gift' => :'Gift', + :'loyalty_card' => :'CampaignLoyaltyCard' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'redemption', + :'is_referral_code', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'code_config') + self.code_config = attributes[:'code_config'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER", "GIFT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + discount == o.discount && + code_config == o.code_config && + redemption == o.redemption && + is_referral_code == o.is_referral_code && + gift == o.gift && + loyalty_card == o.loyalty_card + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, discount, code_config, redemption, is_referral_code, gift, loyalty_card].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_create_request_body_voucher_redemption.rb b/lib/VoucherifySdk/models/campaigns_create_request_body_voucher_redemption.rb new file mode 100644 index 00000000..b890e623 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_create_request_body_voucher_redemption.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class CampaignsCreateRequestBodyVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_create_response_body.rb b/lib/VoucherifySdk/models/campaigns_create_response_body.rb index 11bc9fdf..a2a9636b 100644 --- a/lib/VoucherifySdk/models/campaigns_create_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}`. + # Response body schema for **POST** `v1/campaigns/{campaignId}`. class CampaignsCreateResponseBody # Unique campaign ID, assigned by Voucherify. attr_accessor :id @@ -44,10 +44,12 @@ class CampaignsCreateResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :validity_hours + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. attr_accessor :activity_duration_after_publishing # Total number of unique vouchers in campaign. @@ -65,10 +67,10 @@ class CampaignsCreateResponseBody # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the campaign was created in ISO 8601 format. + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the voucher was updated in ISO 8601 format. + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. attr_accessor :updated_at # Unique category name. @@ -77,7 +79,7 @@ class CampaignsCreateResponseBody # Indicates the status of the campaign creation. attr_accessor :creation_status - # Indicates the status of the campaign's vouchers. + # Indicates the status of the campaign's voucher generation. attr_accessor :vouchers_generation_status # Indicates whether the resource can be deleted. @@ -89,7 +91,7 @@ class CampaignsCreateResponseBody # Contains details about the category. attr_accessor :categories - # The type of object represented by JSON. This object stores information about the campaign. + # The type of the object represented by JSON. This object stores information about the campaign. attr_accessor :object attr_accessor :referral_program @@ -100,6 +102,8 @@ class CampaignsCreateResponseBody attr_accessor :validation_rules_assignments + attr_accessor :access_settings_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -136,6 +140,7 @@ def self.attribute_map :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'activity_duration_after_publishing' => :'activity_duration_after_publishing', :'vouchers_count' => :'vouchers_count', :'start_date' => :'start_date', @@ -154,7 +159,8 @@ def self.attribute_map :'referral_program' => :'referral_program', :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', :'promotion' => :'promotion', - :'validation_rules_assignments' => :'validation_rules_assignments' + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' } end @@ -175,8 +181,9 @@ def self.openapi_types :'auto_join' => :'Boolean', :'join_once' => :'Boolean', :'use_voucher_metadata_schema' => :'Boolean', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'activity_duration_after_publishing' => :'String', :'vouchers_count' => :'Integer', :'start_date' => :'Time', @@ -195,49 +202,54 @@ def self.openapi_types :'referral_program' => :'ReferralProgram', :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', :'promotion' => :'PromotionTiersList', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', :'category_id', + :'categories', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Campaign' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'description') @@ -246,14 +258,10 @@ def initialize(attributes = {}) if attributes.key?(:'campaign_type') self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'voucher') @@ -262,20 +270,14 @@ def initialize(attributes = {}) if attributes.key?(:'auto_join') self.auto_join = attributes[:'auto_join'] - else - self.auto_join = nil end if attributes.key?(:'join_once') self.join_once = attributes[:'join_once'] - else - self.join_once = nil end if attributes.key?(:'use_voucher_metadata_schema') self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - else - self.use_voucher_metadata_schema = nil end if attributes.key?(:'validity_timeframe') @@ -288,6 +290,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'activity_duration_after_publishing') self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] end @@ -314,8 +320,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -328,34 +332,24 @@ def initialize(attributes = {}) if attributes.key?(:'creation_status') self.creation_status = attributes[:'creation_status'] - else - self.creation_status = nil end if attributes.key?(:'vouchers_generation_status') self.vouchers_generation_status = attributes[:'vouchers_generation_status'] - else - self.vouchers_generation_status = nil end if attributes.key?(:'protected') self.protected = attributes[:'protected'] - else - self.protected = nil end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end if attributes.key?(:'object') @@ -379,6 +373,10 @@ def initialize(attributes = {}) if attributes.key?(:'validation_rules_assignments') self.validation_rules_assignments = attributes[:'validation_rules_assignments'] end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -386,58 +384,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @campaign_type.nil? - invalid_properties.push('invalid value for "campaign_type", campaign_type cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @auto_join.nil? - invalid_properties.push('invalid value for "auto_join", auto_join cannot be nil.') - end - - if @join_once.nil? - invalid_properties.push('invalid value for "join_once", join_once cannot be nil.') - end - - if @use_voucher_metadata_schema.nil? - invalid_properties.push('invalid value for "use_voucher_metadata_schema", use_voucher_metadata_schema cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @creation_status.nil? - invalid_properties.push('invalid value for "creation_status", creation_status cannot be nil.') - end - - if @vouchers_generation_status.nil? - invalid_properties.push('invalid value for "vouchers_generation_status", vouchers_generation_status cannot be nil.') - end - - if @protected.nil? - invalid_properties.push('invalid value for "protected", protected cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -445,70 +391,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @campaign_type.nil? campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) return false unless campaign_type_validator.valid?(@campaign_type) - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) return false unless type_validator.valid?(@type) - return false if @auto_join.nil? - return false if @join_once.nil? - return false if @use_voucher_metadata_schema.nil? - return false if @created_at.nil? - return false if @creation_status.nil? creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless creation_status_validator.valid?(@creation_status) - return false if @vouchers_generation_status.nil? vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) - return false if @protected.nil? - return false if @categories.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] creation_status Object to be assigned - def creation_status=(creation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(creation_status) - fail ArgumentError, "invalid value for \"creation_status\", must be one of #{validator.allowable_values}." - end - @creation_status = creation_status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] vouchers_generation_status Object to be assigned - def vouchers_generation_status=(vouchers_generation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(vouchers_generation_status) - fail ArgumentError, "invalid value for \"vouchers_generation_status\", must be one of #{validator.allowable_values}." - end - @vouchers_generation_status = vouchers_generation_status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -525,6 +418,7 @@ def ==(o) use_voucher_metadata_schema == o.use_voucher_metadata_schema && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && activity_duration_after_publishing == o.activity_duration_after_publishing && vouchers_count == o.vouchers_count && start_date == o.start_date && @@ -543,7 +437,8 @@ def ==(o) referral_program == o.referral_program && loyalty_tiers_expiration == o.loyalty_tiers_expiration && promotion == o.promotion && - validation_rules_assignments == o.validation_rules_assignments + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments end # @see the `==` method @@ -555,7 +450,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments].hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments, access_settings_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaigns_delete_response_body.rb b/lib/VoucherifySdk/models/campaigns_delete_response_body.rb index cfc9158f..ab65afc3 100644 --- a/lib/VoucherifySdk/models/campaigns_delete_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_delete_response_body.rb @@ -41,21 +41,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsDeleteResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsDeleteResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/campaigns_disable_response_body.rb b/lib/VoucherifySdk/models/campaigns_disable_response_body.rb deleted file mode 100644 index c03aa28e..00000000 --- a/lib/VoucherifySdk/models/campaigns_disable_response_body.rb +++ /dev/null @@ -1,206 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}/disable`. - class CampaignsDisableResponseBody - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsDisableResponseBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsDisableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_enable_response_body.rb b/lib/VoucherifySdk/models/campaigns_enable_response_body.rb deleted file mode 100644 index 81262290..00000000 --- a/lib/VoucherifySdk/models/campaigns_enable_response_body.rb +++ /dev/null @@ -1,206 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}/enable`. - class CampaignsEnableResponseBody - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsEnableResponseBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsEnableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_get_response_body.rb b/lib/VoucherifySdk/models/campaigns_get_response_body.rb index 1bfdef13..5e1d5c17 100644 --- a/lib/VoucherifySdk/models/campaigns_get_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/campaigns/{campaignId}`. + # Response body schema for **GET** `v1/campaigns/{campaignId}`. class CampaignsGetResponseBody # Unique campaign ID, assigned by Voucherify. attr_accessor :id @@ -44,10 +44,12 @@ class CampaignsGetResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :validity_hours + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. attr_accessor :activity_duration_after_publishing # Total number of unique vouchers in campaign. @@ -65,10 +67,10 @@ class CampaignsGetResponseBody # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the campaign was created in ISO 8601 format. + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the voucher was updated in ISO 8601 format. + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. attr_accessor :updated_at # Unique category name. @@ -77,7 +79,7 @@ class CampaignsGetResponseBody # Indicates the status of the campaign creation. attr_accessor :creation_status - # Indicates the status of the campaign's vouchers. + # Indicates the status of the campaign's voucher generation. attr_accessor :vouchers_generation_status # Indicates whether the resource can be deleted. @@ -89,7 +91,7 @@ class CampaignsGetResponseBody # Contains details about the category. attr_accessor :categories - # The type of object represented by JSON. This object stores information about the campaign. + # The type of the object represented by JSON. This object stores information about the campaign. attr_accessor :object attr_accessor :referral_program @@ -100,6 +102,8 @@ class CampaignsGetResponseBody attr_accessor :validation_rules_assignments + attr_accessor :access_settings_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -136,6 +140,7 @@ def self.attribute_map :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'activity_duration_after_publishing' => :'activity_duration_after_publishing', :'vouchers_count' => :'vouchers_count', :'start_date' => :'start_date', @@ -154,7 +159,8 @@ def self.attribute_map :'referral_program' => :'referral_program', :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', :'promotion' => :'promotion', - :'validation_rules_assignments' => :'validation_rules_assignments' + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' } end @@ -175,8 +181,9 @@ def self.openapi_types :'auto_join' => :'Boolean', :'join_once' => :'Boolean', :'use_voucher_metadata_schema' => :'Boolean', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'activity_duration_after_publishing' => :'String', :'vouchers_count' => :'Integer', :'start_date' => :'Time', @@ -195,49 +202,54 @@ def self.openapi_types :'referral_program' => :'ReferralProgram', :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', :'promotion' => :'PromotionTiersList', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', :'category_id', + :'categories', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Campaign' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'description') @@ -246,14 +258,10 @@ def initialize(attributes = {}) if attributes.key?(:'campaign_type') self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'voucher') @@ -262,20 +270,14 @@ def initialize(attributes = {}) if attributes.key?(:'auto_join') self.auto_join = attributes[:'auto_join'] - else - self.auto_join = nil end if attributes.key?(:'join_once') self.join_once = attributes[:'join_once'] - else - self.join_once = nil end if attributes.key?(:'use_voucher_metadata_schema') self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - else - self.use_voucher_metadata_schema = nil end if attributes.key?(:'validity_timeframe') @@ -288,6 +290,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'activity_duration_after_publishing') self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] end @@ -314,8 +320,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -328,34 +332,24 @@ def initialize(attributes = {}) if attributes.key?(:'creation_status') self.creation_status = attributes[:'creation_status'] - else - self.creation_status = nil end if attributes.key?(:'vouchers_generation_status') self.vouchers_generation_status = attributes[:'vouchers_generation_status'] - else - self.vouchers_generation_status = nil end if attributes.key?(:'protected') self.protected = attributes[:'protected'] - else - self.protected = nil end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end if attributes.key?(:'object') @@ -379,6 +373,10 @@ def initialize(attributes = {}) if attributes.key?(:'validation_rules_assignments') self.validation_rules_assignments = attributes[:'validation_rules_assignments'] end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -386,58 +384,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @campaign_type.nil? - invalid_properties.push('invalid value for "campaign_type", campaign_type cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @auto_join.nil? - invalid_properties.push('invalid value for "auto_join", auto_join cannot be nil.') - end - - if @join_once.nil? - invalid_properties.push('invalid value for "join_once", join_once cannot be nil.') - end - - if @use_voucher_metadata_schema.nil? - invalid_properties.push('invalid value for "use_voucher_metadata_schema", use_voucher_metadata_schema cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @creation_status.nil? - invalid_properties.push('invalid value for "creation_status", creation_status cannot be nil.') - end - - if @vouchers_generation_status.nil? - invalid_properties.push('invalid value for "vouchers_generation_status", vouchers_generation_status cannot be nil.') - end - - if @protected.nil? - invalid_properties.push('invalid value for "protected", protected cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -445,70 +391,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @campaign_type.nil? campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) return false unless campaign_type_validator.valid?(@campaign_type) - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) return false unless type_validator.valid?(@type) - return false if @auto_join.nil? - return false if @join_once.nil? - return false if @use_voucher_metadata_schema.nil? - return false if @created_at.nil? - return false if @creation_status.nil? creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless creation_status_validator.valid?(@creation_status) - return false if @vouchers_generation_status.nil? vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) - return false if @protected.nil? - return false if @categories.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] creation_status Object to be assigned - def creation_status=(creation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(creation_status) - fail ArgumentError, "invalid value for \"creation_status\", must be one of #{validator.allowable_values}." - end - @creation_status = creation_status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] vouchers_generation_status Object to be assigned - def vouchers_generation_status=(vouchers_generation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(vouchers_generation_status) - fail ArgumentError, "invalid value for \"vouchers_generation_status\", must be one of #{validator.allowable_values}." - end - @vouchers_generation_status = vouchers_generation_status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -525,6 +418,7 @@ def ==(o) use_voucher_metadata_schema == o.use_voucher_metadata_schema && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && activity_duration_after_publishing == o.activity_duration_after_publishing && vouchers_count == o.vouchers_count && start_date == o.start_date && @@ -543,7 +437,8 @@ def ==(o) referral_program == o.referral_program && loyalty_tiers_expiration == o.loyalty_tiers_expiration && promotion == o.promotion && - validation_rules_assignments == o.validation_rules_assignments + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments end # @see the `==` method @@ -555,7 +450,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments].hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments, access_settings_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaigns_import_create_response_body.rb b/lib/VoucherifySdk/models/campaigns_import_create_response_body.rb index 182ed6ee..c67eb32e 100644 --- a/lib/VoucherifySdk/models/campaigns_import_create_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_import_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}/import`. + # Response body schema for **POST** `v1/campaigns/{campaignId}/import`. class CampaignsImportCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsImportCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsImportCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/campaigns_import_csv_create_response_body.rb b/lib/VoucherifySdk/models/campaigns_import_csv_create_response_body.rb index c254ec02..3ce13a58 100644 --- a/lib/VoucherifySdk/models/campaigns_import_csv_create_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_import_csv_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}/importCSV`. + # Response body schema for **POST** `v1/campaigns/{campaignId}/importCSV`. class CampaignsImportCsvCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsImportCsvCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsImportCsvCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/campaigns_import_voucher_item.rb b/lib/VoucherifySdk/models/campaigns_import_voucher_item.rb index 802d108a..b666c41d 100644 --- a/lib/VoucherifySdk/models/campaigns_import_voucher_item.rb +++ b/lib/VoucherifySdk/models/campaigns_import_voucher_item.rb @@ -14,41 +14,41 @@ require 'time' module VoucherifySdk - # Import Vouchers to Campaign class CampaignsImportVoucherItem - # Unique custom voucher code. + # Value representing the imported code. attr_accessor :code - # Type of voucher. - attr_accessor :type - attr_accessor :redemption # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher attr_accessor :active - # The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. attr_accessor :metadata - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. attr_accessor :category - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + # Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ attr_accessor :start_date + # Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + attr_accessor :expiration_date + attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week # An optional field to keep any extra textual information about the code such as a code description and details. attr_accessor :additional_info - attr_accessor :discount + attr_accessor :type + + attr_accessor :loyalty_card attr_accessor :gift - attr_accessor :loyalty_card + attr_accessor :discount class EnumAttributeValidator attr_reader :datatype @@ -76,18 +76,19 @@ def valid?(value) def self.attribute_map { :'code' => :'code', - :'type' => :'type', :'redemption' => :'redemption', :'active' => :'active', :'metadata' => :'metadata', :'category' => :'category', :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', :'additional_info' => :'additional_info', - :'discount' => :'discount', + :'type' => :'type', + :'loyalty_card' => :'loyalty_card', :'gift' => :'gift', - :'loyalty_card' => :'loyalty_card' + :'discount' => :'discount' } end @@ -100,50 +101,47 @@ def self.acceptable_attributes def self.openapi_types { :'code' => :'String', - :'type' => :'String', :'redemption' => :'CampaignsImportVoucherItemRedemption', :'active' => :'Boolean', :'metadata' => :'Object', :'category' => :'String', :'start_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', :'additional_info' => :'String', - :'discount' => :'Discount', + :'type' => :'String', + :'loyalty_card' => :'SimpleLoyaltyCard', :'gift' => :'Gift', - :'loyalty_card' => :'CampaignsImportVoucherLoyaltyCard' + :'discount' => :'Discount' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code', + :'redemption', + :'active', + :'metadata', + :'category', + :'start_date', + :'expiration_date', + :'additional_info', + :'type', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsImportVoucherItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsImportVoucherItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] end if attributes.key?(:'redemption') @@ -166,6 +164,10 @@ def initialize(attributes = {}) self.start_date = attributes[:'start_date'] end + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + if attributes.key?(:'validity_timeframe') self.validity_timeframe = attributes[:'validity_timeframe'] end @@ -180,16 +182,20 @@ def initialize(attributes = {}) self.additional_info = attributes[:'additional_info'] end - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] end if attributes.key?(:'gift') self.gift = attributes[:'gift'] end - if attributes.key?(:'loyalty_card') - self.loyalty_card = attributes[:'loyalty_card'] + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] end end @@ -198,10 +204,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - invalid_properties end @@ -209,40 +211,30 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? - type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER", "GIFT_VOUCHER", "LOYALTY_CARD", "LUCKY_DRAW_CODE"]) + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD", "GIFT_VOUCHER", "DISCOUNT_VOUCHER"]) return false unless type_validator.valid?(@type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER", "GIFT_VOUCHER", "LOYALTY_CARD", "LUCKY_DRAW_CODE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && code == o.code && - type == o.type && redemption == o.redemption && active == o.active && metadata == o.metadata && category == o.category && start_date == o.start_date && + expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && additional_info == o.additional_info && - discount == o.discount && + type == o.type && + loyalty_card == o.loyalty_card && gift == o.gift && - loyalty_card == o.loyalty_card + discount == o.discount end # @see the `==` method @@ -254,7 +246,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [code, type, redemption, active, metadata, category, start_date, validity_timeframe, validity_day_of_week, additional_info, discount, gift, loyalty_card].hash + [code, redemption, active, metadata, category, start_date, expiration_date, validity_timeframe, validity_day_of_week, additional_info, type, loyalty_card, gift, discount].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaigns_import_voucher_item_redemption.rb b/lib/VoucherifySdk/models/campaigns_import_voucher_item_redemption.rb index a2f34887..c6b3f855 100644 --- a/lib/VoucherifySdk/models/campaigns_import_voucher_item_redemption.rb +++ b/lib/VoucherifySdk/models/campaigns_import_voucher_item_redemption.rb @@ -14,7 +14,6 @@ require 'time' module VoucherifySdk - # Stores the quantity of redemptions that can be applied to the voucher. class CampaignsImportVoucherItemRedemption # How many times a voucher can be redeemed. A `null` value means unlimited. attr_accessor :quantity @@ -41,21 +40,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'quantity' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsImportVoucherItemRedemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsImportVoucherItemRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/campaigns_import_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/campaigns_import_voucher_loyalty_card.rb deleted file mode 100644 index 91326e35..00000000 --- a/lib/VoucherifySdk/models/campaigns_import_voucher_loyalty_card.rb +++ /dev/null @@ -1,223 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Schema model for a campaign loyalty card. - class CampaignsImportVoucherLoyaltyCard - # The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsImportVoucherLoyaltyCard` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsImportVoucherLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_list_response_body.rb b/lib/VoucherifySdk/models/campaigns_list_response_body.rb index c6fac9d3..1309c8cc 100644 --- a/lib/VoucherifySdk/models/campaigns_list_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Schema model for **GET** `/campaigns`. + # Schema model for **GET** `v1/campaigns`. class CampaignsListResponseBody - # The type of object represented by JSON. This object stores information about campaigns in a dictionary. + # The type of the object represented by JSON. This object stores information about campaigns in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of campaign objects. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'campaigns', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/campaigns_update_base.rb b/lib/VoucherifySdk/models/campaigns_update_base.rb deleted file mode 100644 index f2cac97f..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_base.rb +++ /dev/null @@ -1,300 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Base body schema for creating a campaign using **PUT** `/campaigns`. - class CampaignsUpdateBase - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_coupon_campaign_base.rb b/lib/VoucherifySdk/models/campaigns_update_coupon_campaign_base.rb deleted file mode 100644 index 045a3b57..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_coupon_campaign_base.rb +++ /dev/null @@ -1,381 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Base body schema for updating a campaign which contains coupon codes using **PUT** `/campaigns`. - class CampaignsUpdateCouponCampaignBase - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'type' => :'type' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String', - :'activity_duration_after_publishing' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'type' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateCouponCampaignBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateCouponCampaignBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id && - activity_duration_after_publishing == o.activity_duration_after_publishing && - join_once == o.join_once && - auto_join == o.auto_join && - type == o.type - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_discount_coupons_campaign.rb b/lib/VoucherifySdk/models/campaigns_update_discount_coupons_campaign.rb deleted file mode 100644 index a8d30337..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_discount_coupons_campaign.rb +++ /dev/null @@ -1,389 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsUpdateDiscountCouponsCampaign - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - attr_accessor :discount - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'type' => :'type', - :'discount' => :'discount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String', - :'activity_duration_after_publishing' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'type' => :'String', - :'discount' => :'Discount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateCouponCampaignBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateDiscountCouponsCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateDiscountCouponsCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id && - activity_duration_after_publishing == o.activity_duration_after_publishing && - join_once == o.join_once && - auto_join == o.auto_join && - type == o.type && - discount == o.discount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, discount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_gift_campaign.rb b/lib/VoucherifySdk/models/campaigns_update_gift_campaign.rb deleted file mode 100644 index b2f7918c..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_gift_campaign.rb +++ /dev/null @@ -1,389 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsUpdateGiftCampaign - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - attr_accessor :gift - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'type' => :'type', - :'gift' => :'gift' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String', - :'activity_duration_after_publishing' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'type' => :'String', - :'gift' => :'Gift' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateCouponCampaignBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateGiftCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateGiftCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'gift') - self.gift = attributes[:'gift'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id && - activity_duration_after_publishing == o.activity_duration_after_publishing && - join_once == o.join_once && - auto_join == o.auto_join && - type == o.type && - gift == o.gift - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, gift].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_giveaway_campaign.rb b/lib/VoucherifySdk/models/campaigns_update_giveaway_campaign.rb deleted file mode 100644 index d63c2f63..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_giveaway_campaign.rb +++ /dev/null @@ -1,420 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsUpdateGiveawayCampaign - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # It represents the total number of winners in a lucky draw. - attr_accessor :winners_count - - # It indicates whether each winner in a draw is unique or not. - attr_accessor :unique_winners_per_draw - - # Specifies whether each participant can win only once across multiple draws. - attr_accessor :unique_winners - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'type' => :'type', - :'winners_count' => :'winners_count', - :'unique_winners_per_draw' => :'unique_winners_per_draw', - :'unique_winners' => :'unique_winners' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String', - :'activity_duration_after_publishing' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'type' => :'String', - :'winners_count' => :'String', - :'unique_winners_per_draw' => :'String', - :'unique_winners' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateCouponCampaignBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateGiveawayCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateGiveawayCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'winners_count') - self.winners_count = attributes[:'winners_count'] - end - - if attributes.key?(:'unique_winners_per_draw') - self.unique_winners_per_draw = attributes[:'unique_winners_per_draw'] - end - - if attributes.key?(:'unique_winners') - self.unique_winners = attributes[:'unique_winners'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method with validation - # @param [Object] winners_count Value to be assigned - def winners_count=(winners_count) - if winners_count.nil? - fail ArgumentError, 'winners_count cannot be nil' - end - - @winners_count = winners_count - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id && - activity_duration_after_publishing == o.activity_duration_after_publishing && - join_once == o.join_once && - auto_join == o.auto_join && - type == o.type && - winners_count == o.winners_count && - unique_winners_per_draw == o.unique_winners_per_draw && - unique_winners == o.unique_winners - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, winners_count, unique_winners_per_draw, unique_winners].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_loyalty_campaign.rb b/lib/VoucherifySdk/models/campaigns_update_loyalty_campaign.rb deleted file mode 100644 index eb732f6a..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_loyalty_campaign.rb +++ /dev/null @@ -1,398 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsUpdateLoyaltyCampaign - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - attr_accessor :loyalty_tiers_expiration - - attr_accessor :options - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'type' => :'type', - :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', - :'options' => :'options' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String', - :'activity_duration_after_publishing' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'type' => :'String', - :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', - :'options' => :'PropertiesForLoyaltyCampaignOptions' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateCouponCampaignBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateLoyaltyCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateLoyaltyCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'loyalty_tiers_expiration') - self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] - end - - if attributes.key?(:'options') - self.options = attributes[:'options'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id && - activity_duration_after_publishing == o.activity_duration_after_publishing && - join_once == o.join_once && - auto_join == o.auto_join && - type == o.type && - loyalty_tiers_expiration == o.loyalty_tiers_expiration && - options == o.options - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, loyalty_tiers_expiration, options].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_promotion_campaign.rb b/lib/VoucherifySdk/models/campaigns_update_promotion_campaign.rb deleted file mode 100644 index 8a7f7997..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_promotion_campaign.rb +++ /dev/null @@ -1,306 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsUpdatePromotionCampaign - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdatePromotionCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdatePromotionCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_referral_campaign.rb b/lib/VoucherifySdk/models/campaigns_update_referral_campaign.rb deleted file mode 100644 index 98d29969..00000000 --- a/lib/VoucherifySdk/models/campaigns_update_referral_campaign.rb +++ /dev/null @@ -1,398 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsUpdateReferralCampaign - # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # An optional field to keep any extra textual information about the campaign such as a campaign description and details. - attr_accessor :description - - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. - attr_accessor :metadata - - # Determine which metadata should be removed from campaign. - attr_accessor :unset_metadata_fields - - # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. - attr_accessor :category_id - - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. - attr_accessor :activity_duration_after_publishing - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - attr_accessor :discount - - attr_accessor :referral_program - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'description' => :'description', - :'category' => :'category', - :'metadata' => :'metadata', - :'unset_metadata_fields' => :'unset_metadata_fields', - :'category_id' => :'category_id', - :'activity_duration_after_publishing' => :'activity_duration_after_publishing', - :'join_once' => :'join_once', - :'auto_join' => :'auto_join', - :'type' => :'type', - :'discount' => :'discount', - :'referral_program' => :'referral_program' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'description' => :'String', - :'category' => :'String', - :'metadata' => :'Object', - :'unset_metadata_fields' => :'Array', - :'category_id' => :'String', - :'activity_duration_after_publishing' => :'String', - :'join_once' => :'Boolean', - :'auto_join' => :'Boolean', - :'type' => :'String', - :'discount' => :'Discount', - :'referral_program' => :'ReferralProgram' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'unset_metadata_fields', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsUpdateCouponCampaignBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateReferralCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateReferralCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'unset_metadata_fields') - if (value = attributes[:'unset_metadata_fields']).is_a?(Array) - self.unset_metadata_fields = value - end - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'activity_duration_after_publishing') - self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - end - - if attributes.key?(:'referral_program') - self.referral_program = attributes[:'referral_program'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - description == o.description && - category == o.category && - metadata == o.metadata && - unset_metadata_fields == o.unset_metadata_fields && - category_id == o.category_id && - activity_duration_after_publishing == o.activity_duration_after_publishing && - join_once == o.join_once && - auto_join == o.auto_join && - type == o.type && - discount == o.discount && - referral_program == o.referral_program - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [start_date, expiration_date, validity_timeframe, validity_day_of_week, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, discount, referral_program].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_update_request_body.rb b/lib/VoucherifySdk/models/campaigns_update_request_body.rb index 2e753b6d..09eefcf8 100644 --- a/lib/VoucherifySdk/models/campaigns_update_request_body.rb +++ b/lib/VoucherifySdk/models/campaigns_update_request_body.rb @@ -14,97 +14,441 @@ require 'time' module VoucherifySdk - # Request body schema for **PUT** `/campaigns/{campaignId}`. - module CampaignsUpdateRequestBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'CampaignsUpdateDiscountCouponsCampaign', - :'CampaignsUpdateGiftCampaign', - :'CampaignsUpdateGiveawayCampaign', - :'CampaignsUpdateLoyaltyCampaign', - :'CampaignsUpdatePromotionCampaign', - :'CampaignsUpdateReferralCampaign' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class CampaignsUpdateRequestBody + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # The category assigned to the campaign. Either pass this parameter OR the `category_id`. + attr_accessor :category + + attr_accessor :metadata + + # Determine which metadata should be removed from campaign. + attr_accessor :unset_metadata_fields + + # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + attr_accessor :category_id + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :referral_program + + attr_accessor :gift + + attr_accessor :loyalty_tiers_expiration + + attr_accessor :options + + # It represents the total number of winners in a lucky draw. + attr_accessor :winners_count + + # It indicates whether each winner in a draw is unique or not. + attr_accessor :unique_winners_per_draw + + # Specifies whether each participant can win only once across multiple draws. + attr_accessor :unique_winners + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'description' => :'description', + :'category' => :'category', + :'metadata' => :'metadata', + :'unset_metadata_fields' => :'unset_metadata_fields', + :'category_id' => :'category_id', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'join_once' => :'join_once', + :'auto_join' => :'auto_join', + :'type' => :'type', + :'discount' => :'discount', + :'referral_program' => :'referral_program', + :'gift' => :'gift', + :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', + :'options' => :'options', + :'winners_count' => :'winners_count', + :'unique_winners_per_draw' => :'unique_winners_per_draw', + :'unique_winners' => :'unique_winners' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'description' => :'String', + :'category' => :'String', + :'metadata' => :'Object', + :'unset_metadata_fields' => :'Array', + :'category_id' => :'String', + :'activity_duration_after_publishing' => :'String', + :'join_once' => :'Boolean', + :'auto_join' => :'Boolean', + :'type' => :'String', + :'discount' => :'Object', + :'referral_program' => :'ReferralProgram', + :'gift' => :'Gift', + :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', + :'options' => :'CampaignsUpdateRequestBodyOptions', + :'winners_count' => :'String', + :'unique_winners_per_draw' => :'String', + :'unique_winners' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'start_date', + :'expiration_date', + :'description', + :'category', + :'metadata', + :'unset_metadata_fields', + :'category_id', + :'activity_duration_after_publishing', + :'join_once', + :'auto_join', + :'type', + :'discount', + :'options', + :'winners_count', + :'unique_winners_per_draw', + :'unique_winners' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'unset_metadata_fields') + if (value = attributes[:'unset_metadata_fields']).is_a?(Array) + self.unset_metadata_fields = value + end + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'referral_program') + self.referral_program = attributes[:'referral_program'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_tiers_expiration') + self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] + end + + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + + if attributes.key?(:'winners_count') + self.winners_count = attributes[:'winners_count'] + end + + if attributes.key?(:'unique_winners_per_draw') + self.unique_winners_per_draw = attributes[:'unique_winners_per_draw'] + end + + if attributes.key?(:'unique_winners') + self.unique_winners = attributes[:'unique_winners'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + description == o.description && + category == o.category && + metadata == o.metadata && + unset_metadata_fields == o.unset_metadata_fields && + category_id == o.category_id && + activity_duration_after_publishing == o.activity_duration_after_publishing && + join_once == o.join_once && + auto_join == o.auto_join && + type == o.type && + discount == o.discount && + referral_program == o.referral_program && + gift == o.gift && + loyalty_tiers_expiration == o.loyalty_tiers_expiration && + options == o.options && + winners_count == o.winners_count && + unique_winners_per_draw == o.unique_winners_per_draw && + unique_winners == o.unique_winners + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, discount, referral_program, gift, loyalty_tiers_expiration, options, winners_count, unique_winners_per_draw, unique_winners].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/campaigns_update_request_body_options.rb b/lib/VoucherifySdk/models/campaigns_update_request_body_options.rb new file mode 100644 index 00000000..2086e712 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_update_request_body_options.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class CampaignsUpdateRequestBodyOptions + # Determine if tiers should be recalculated or no. + attr_accessor :recalculate_tiers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'recalculate_tiers' => :'recalculate_tiers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'recalculate_tiers' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'recalculate_tiers' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'recalculate_tiers') + self.recalculate_tiers = attributes[:'recalculate_tiers'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + recalculate_tiers == o.recalculate_tiers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [recalculate_tiers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_update_response_body.rb b/lib/VoucherifySdk/models/campaigns_update_response_body.rb index 057eaab5..1f0f3ba5 100644 --- a/lib/VoucherifySdk/models/campaigns_update_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/campaigns/{campaignId}`. + # Response body schema for **PUT** `v1/campaigns/{campaignId}`. class CampaignsUpdateResponseBody # Unique campaign ID, assigned by Voucherify. attr_accessor :id @@ -44,10 +44,12 @@ class CampaignsUpdateResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week - # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :validity_hours + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. attr_accessor :activity_duration_after_publishing # Total number of unique vouchers in campaign. @@ -65,10 +67,10 @@ class CampaignsUpdateResponseBody # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the campaign was created in ISO 8601 format. + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the voucher was updated in ISO 8601 format. + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. attr_accessor :updated_at # Unique category name. @@ -77,7 +79,7 @@ class CampaignsUpdateResponseBody # Indicates the status of the campaign creation. attr_accessor :creation_status - # Indicates the status of the campaign's vouchers. + # Indicates the status of the campaign's voucher generation. attr_accessor :vouchers_generation_status # Indicates whether the resource can be deleted. @@ -89,7 +91,7 @@ class CampaignsUpdateResponseBody # Contains details about the category. attr_accessor :categories - # The type of object represented by JSON. This object stores information about the campaign. + # The type of the object represented by JSON. This object stores information about the campaign. attr_accessor :object attr_accessor :referral_program @@ -100,6 +102,8 @@ class CampaignsUpdateResponseBody attr_accessor :validation_rules_assignments + attr_accessor :access_settings_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -136,6 +140,7 @@ def self.attribute_map :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'activity_duration_after_publishing' => :'activity_duration_after_publishing', :'vouchers_count' => :'vouchers_count', :'start_date' => :'start_date', @@ -154,7 +159,8 @@ def self.attribute_map :'referral_program' => :'referral_program', :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', :'promotion' => :'promotion', - :'validation_rules_assignments' => :'validation_rules_assignments' + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' } end @@ -175,8 +181,9 @@ def self.openapi_types :'auto_join' => :'Boolean', :'join_once' => :'Boolean', :'use_voucher_metadata_schema' => :'Boolean', - :'validity_timeframe' => :'CampaignBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'activity_duration_after_publishing' => :'String', :'vouchers_count' => :'Integer', :'start_date' => :'Time', @@ -195,49 +202,54 @@ def self.openapi_types :'referral_program' => :'ReferralProgram', :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', :'promotion' => :'PromotionTiersList', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', :'category_id', + :'categories', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Campaign' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'description') @@ -246,14 +258,10 @@ def initialize(attributes = {}) if attributes.key?(:'campaign_type') self.campaign_type = attributes[:'campaign_type'] - else - self.campaign_type = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'voucher') @@ -262,20 +270,14 @@ def initialize(attributes = {}) if attributes.key?(:'auto_join') self.auto_join = attributes[:'auto_join'] - else - self.auto_join = nil end if attributes.key?(:'join_once') self.join_once = attributes[:'join_once'] - else - self.join_once = nil end if attributes.key?(:'use_voucher_metadata_schema') self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] - else - self.use_voucher_metadata_schema = nil end if attributes.key?(:'validity_timeframe') @@ -288,6 +290,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'activity_duration_after_publishing') self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] end @@ -314,8 +320,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -328,34 +332,24 @@ def initialize(attributes = {}) if attributes.key?(:'creation_status') self.creation_status = attributes[:'creation_status'] - else - self.creation_status = nil end if attributes.key?(:'vouchers_generation_status') self.vouchers_generation_status = attributes[:'vouchers_generation_status'] - else - self.vouchers_generation_status = nil end if attributes.key?(:'protected') self.protected = attributes[:'protected'] - else - self.protected = nil end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end if attributes.key?(:'object') @@ -379,6 +373,10 @@ def initialize(attributes = {}) if attributes.key?(:'validation_rules_assignments') self.validation_rules_assignments = attributes[:'validation_rules_assignments'] end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -386,58 +384,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @campaign_type.nil? - invalid_properties.push('invalid value for "campaign_type", campaign_type cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @auto_join.nil? - invalid_properties.push('invalid value for "auto_join", auto_join cannot be nil.') - end - - if @join_once.nil? - invalid_properties.push('invalid value for "join_once", join_once cannot be nil.') - end - - if @use_voucher_metadata_schema.nil? - invalid_properties.push('invalid value for "use_voucher_metadata_schema", use_voucher_metadata_schema cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @creation_status.nil? - invalid_properties.push('invalid value for "creation_status", creation_status cannot be nil.') - end - - if @vouchers_generation_status.nil? - invalid_properties.push('invalid value for "vouchers_generation_status", vouchers_generation_status cannot be nil.') - end - - if @protected.nil? - invalid_properties.push('invalid value for "protected", protected cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -445,70 +391,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @campaign_type.nil? campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) return false unless campaign_type_validator.valid?(@campaign_type) - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) return false unless type_validator.valid?(@type) - return false if @auto_join.nil? - return false if @join_once.nil? - return false if @use_voucher_metadata_schema.nil? - return false if @created_at.nil? - return false if @creation_status.nil? creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless creation_status_validator.valid?(@creation_status) - return false if @vouchers_generation_status.nil? vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) - return false if @protected.nil? - return false if @categories.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] campaign_type Object to be assigned - def campaign_type=(campaign_type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) - unless validator.valid?(campaign_type) - fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}." - end - @campaign_type = campaign_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] creation_status Object to be assigned - def creation_status=(creation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(creation_status) - fail ArgumentError, "invalid value for \"creation_status\", must be one of #{validator.allowable_values}." - end - @creation_status = creation_status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] vouchers_generation_status Object to be assigned - def vouchers_generation_status=(vouchers_generation_status) - validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) - unless validator.valid?(vouchers_generation_status) - fail ArgumentError, "invalid value for \"vouchers_generation_status\", must be one of #{validator.allowable_values}." - end - @vouchers_generation_status = vouchers_generation_status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -525,6 +418,7 @@ def ==(o) use_voucher_metadata_schema == o.use_voucher_metadata_schema && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && activity_duration_after_publishing == o.activity_duration_after_publishing && vouchers_count == o.vouchers_count && start_date == o.start_date && @@ -543,7 +437,8 @@ def ==(o) referral_program == o.referral_program && loyalty_tiers_expiration == o.loyalty_tiers_expiration && promotion == o.promotion && - validation_rules_assignments == o.validation_rules_assignments + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments end # @see the `==` method @@ -555,7 +450,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments].hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, referral_program, loyalty_tiers_expiration, promotion, validation_rules_assignments, access_settings_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_base_request_body.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_base_request_body.rb deleted file mode 100644 index db2ef6ab..00000000 --- a/lib/VoucherifySdk/models/campaigns_vouchers_create_base_request_body.rb +++ /dev/null @@ -1,264 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CampaignsVouchersCreateBaseRequestBody - # The category assigned to the campaign. Either pass this parameter OR the `category_id`. - attr_accessor :category - - # The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. - attr_accessor :metadata - - attr_accessor :redemption - - # An optional field to keep any extra textual information about the code such as a code description and details. - attr_accessor :additional_info - - # Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. - attr_accessor :expiration_date - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'category' => :'category', - :'metadata' => :'metadata', - :'redemption' => :'redemption', - :'additional_info' => :'additional_info', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'category' => :'String', - :'metadata' => :'Object', - :'redemption' => :'CampaignsImportVoucherItemRedemption', - :'additional_info' => :'String', - :'start_date' => :'Time', - :'expiration_date' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsVouchersCreateBaseRequestBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsVouchersCreateBaseRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'additional_info') - self.additional_info = attributes[:'additional_info'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - category == o.category && - metadata == o.metadata && - redemption == o.redemption && - additional_info == o.additional_info && - start_date == o.start_date && - expiration_date == o.expiration_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [category, metadata, redemption, additional_info, start_date, expiration_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body.rb new file mode 100644 index 00000000..f1460091 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body.rb @@ -0,0 +1,543 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class CampaignsVouchersCreateCombinedResponseBody + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + # The ID of the scheduled asynchronous action. + attr_accessor :async_action_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'async_action_id' => :'async_action_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'CampaignsVouchersCreateCombinedResponseBodyGift', + :'loyalty_card' => :'CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'CampaignsVouchersCreateCombinedResponseBodyPublish', + :'redemption' => :'CampaignsVouchersCreateCombinedResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'async_action_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + :'async_action_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'async_action_id') + self.async_action_id = attributes[:'async_action_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments && + async_action_id == o.async_action_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments, async_action_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_gift.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_gift.rb new file mode 100644 index 00000000..04339cc1 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class CampaignsVouchersCreateCombinedResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_loyalty_card.rb new file mode 100644 index 00000000..1ff27ab3 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_publish.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_publish.rb new file mode 100644 index 00000000..f8974181 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class CampaignsVouchersCreateCombinedResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_redemption.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_redemption.rb new file mode 100644 index 00000000..8961d88c --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class CampaignsVouchersCreateCombinedResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body.rb index 1264d377..67b78b47 100644 --- a/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body.rb +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body.rb @@ -14,8 +14,13 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/campaigns/{campaignId}/vouchers`. + # Request body schema for **POST** `v1/campaigns/{campaignId}/vouchers`. class CampaignsVouchersCreateInBulkRequestBody + # Unique voucher code. + attr_accessor :code + + attr_accessor :code_config + # The category assigned to the campaign. Either pass this parameter OR the `category_id`. attr_accessor :category @@ -33,22 +38,17 @@ class CampaignsVouchersCreateInBulkRequestBody # Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. attr_accessor :expiration_date - # Unique voucher code. - attr_accessor :code - - attr_accessor :code_config - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'code' => :'code', + :'code_config' => :'code_config', :'category' => :'category', :'metadata' => :'metadata', :'redemption' => :'redemption', :'additional_info' => :'additional_info', :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'code' => :'code', - :'code_config' => :'code_config' + :'expiration_date' => :'expiration_date' } end @@ -60,45 +60,46 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'code' => :'String', + :'code_config' => :'CodeConfig', :'category' => :'String', :'metadata' => :'Object', - :'redemption' => :'CampaignsImportVoucherItemRedemption', + :'redemption' => :'CampaignsVouchersCreateInBulkRequestBodyRedemption', :'additional_info' => :'String', :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'code' => :'String', - :'code_config' => :'CodeConfig' + :'expiration_date' => :'Time' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code', + :'category', + :'metadata', + :'redemption', + :'additional_info', + :'start_date', + :'expiration_date' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsVouchersCreateBaseRequestBody' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsVouchersCreateInBulkRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsVouchersCreateInBulkRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'code_config') + self.code_config = attributes[:'code_config'] + end + if attributes.key?(:'category') self.category = attributes[:'category'] end @@ -122,14 +123,6 @@ def initialize(attributes = {}) if attributes.key?(:'expiration_date') self.expiration_date = attributes[:'expiration_date'] end - - if attributes.key?(:'code') - self.code = attributes[:'code'] - end - - if attributes.key?(:'code_config') - self.code_config = attributes[:'code_config'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -152,14 +145,14 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + code == o.code && + code_config == o.code_config && category == o.category && metadata == o.metadata && redemption == o.redemption && additional_info == o.additional_info && start_date == o.start_date && - expiration_date == o.expiration_date && - code == o.code && - code_config == o.code_config + expiration_date == o.expiration_date end # @see the `==` method @@ -171,7 +164,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [category, metadata, redemption, additional_info, start_date, expiration_date, code, code_config].hash + [code, code_config, category, metadata, redemption, additional_info, start_date, expiration_date].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body_redemption.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body_redemption.rb new file mode 100644 index 00000000..0700ae5d --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_request_body_redemption.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores the quantity of redemptions that can be applied to the voucher. + class CampaignsVouchersCreateInBulkRequestBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_response_body.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_response_body.rb deleted file mode 100644 index 8c24941c..00000000 --- a/lib/VoucherifySdk/models/campaigns_vouchers_create_in_bulk_response_body.rb +++ /dev/null @@ -1,230 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}`. - class CampaignsVouchersCreateInBulkResponseBody - # The ID of the scheduled asynchronous action. - attr_accessor :async_action_id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'async_action_id' => :'async_action_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'async_action_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsVouchersCreateInBulkResponseBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsVouchersCreateInBulkResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'async_action_id') - self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - async_action_id == o.async_action_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [async_action_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body.rb index 8ba87d5b..1d603716 100644 --- a/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body.rb +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}`. + # Request body schema for **POST** `v1/campaigns/{campaignId}/vouchers/{code}`. class CampaignsVouchersCreateRequestBody # The category assigned to the campaign. Either pass this parameter OR the `category_id`. attr_accessor :category @@ -55,7 +55,7 @@ def self.openapi_types { :'category' => :'String', :'metadata' => :'Object', - :'redemption' => :'CampaignsImportVoucherItemRedemption', + :'redemption' => :'CampaignsVouchersCreateRequestBodyRedemption', :'additional_info' => :'String', :'start_date' => :'Time', :'expiration_date' => :'Time' @@ -65,28 +65,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'category', + :'metadata', + :'redemption', + :'additional_info', + :'start_date', + :'expiration_date' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CampaignsVouchersCreateBaseRequestBody' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsVouchersCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsVouchersCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body_redemption.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body_redemption.rb new file mode 100644 index 00000000..4348fa3d --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_request_body_redemption.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores the quantity of redemptions that can be applied to the voucher. + class CampaignsVouchersCreateRequestBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body.rb index da389408..dfb504e2 100644 --- a/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body.rb +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}` and **POST** `/campaigns/{campaignId}/vouchers`. + # Response body schema for **POST** `v1/campaigns/{campaignId}/vouchers/{code}` and **POST** `v1/campaigns/{campaignId}/vouchers`. class CampaignsVouchersCreateResponseBody # Assigned by the Voucherify API, identifies the voucher. attr_accessor :id @@ -34,9 +34,6 @@ class CampaignsVouchersCreateResponseBody # Unique category ID assigned by Voucherify. attr_accessor :category_id - # Contains details about the category. - attr_accessor :categories - # Defines the type of the voucher. attr_accessor :type @@ -54,9 +51,11 @@ class CampaignsVouchersCreateResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher attr_accessor :active @@ -71,31 +70,30 @@ class CampaignsVouchersCreateResponseBody # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Timestamp representing the date and time when the voucher was created in ISO 8601 format. + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. attr_accessor :updated_at - # Unique customer ID of voucher owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id - attr_accessor :holder + # Unique identifier of the referring person. + attr_accessor :referrer_id - # The type of object represented by JSON. Default is `voucher`. + # The type of the object represented by JSON. Default is `voucher`. attr_accessor :object - attr_accessor :distributions - - # Flag indicating whether this voucher is deleted. - attr_accessor :deleted - - attr_accessor :validation_rules_assignments - attr_accessor :publish attr_accessor :redemption + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -127,7 +125,6 @@ def self.attribute_map :'campaign_id' => :'campaign_id', :'category' => :'category', :'category_id' => :'category_id', - :'categories' => :'categories', :'type' => :'type', :'discount' => :'discount', :'gift' => :'gift', @@ -136,6 +133,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'active' => :'active', :'additional_info' => :'additional_info', :'metadata' => :'metadata', @@ -144,13 +142,12 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'holder_id' => :'holder_id', - :'holder' => :'holder', + :'referrer_id' => :'referrer_id', :'object' => :'object', - :'distributions' => :'distributions', - :'deleted' => :'deleted', - :'validation_rules_assignments' => :'validation_rules_assignments', :'publish' => :'publish', - :'redemption' => :'redemption' + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' } end @@ -168,15 +165,15 @@ def self.openapi_types :'campaign_id' => :'String', :'category' => :'String', :'category_id' => :'String', - :'categories' => :'Array', :'type' => :'String', :'discount' => :'Discount', - :'gift' => :'VoucherGift', - :'loyalty_card' => :'VoucherLoyaltyCard', + :'gift' => :'CampaignsVouchersCreateResponseBodyGift', + :'loyalty_card' => :'CampaignsVouchersCreateResponseBodyLoyaltyCard', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'VoucherValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'active' => :'Boolean', :'additional_info' => :'String', :'metadata' => :'Object', @@ -185,43 +182,49 @@ def self.openapi_types :'created_at' => :'Time', :'updated_at' => :'Time', :'holder_id' => :'String', - :'holder' => :'SimpleCustomer', + :'referrer_id' => :'String', :'object' => :'String', - :'distributions' => :'Array', - :'deleted' => :'Boolean', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', - :'publish' => :'VoucherPublish', - :'redemption' => :'VoucherRedemption' + :'publish' => :'CampaignsVouchersCreateResponseBodyPublish', + :'redemption' => :'CampaignsVouchersCreateResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', :'active', + :'additional_info', + :'metadata', :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Voucher' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CampaignsVouchersCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CampaignsVouchersCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -249,12 +252,6 @@ def initialize(attributes = {}) self.category_id = attributes[:'category_id'] end - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -289,6 +286,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'active') self.active = attributes[:'active'] end @@ -321,8 +322,8 @@ def initialize(attributes = {}) self.holder_id = attributes[:'holder_id'] end - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'object') @@ -331,20 +332,6 @@ def initialize(attributes = {}) self.object = 'voucher' end - if attributes.key?(:'distributions') - if (value = attributes[:'distributions']).is_a?(Array) - self.distributions = value - end - end - - if attributes.key?(:'deleted') - self.deleted = attributes[:'deleted'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - if attributes.key?(:'publish') self.publish = attributes[:'publish'] end @@ -352,6 +339,16 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -371,16 +368,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -392,7 +379,6 @@ def ==(o) campaign_id == o.campaign_id && category == o.category && category_id == o.category_id && - categories == o.categories && type == o.type && discount == o.discount && gift == o.gift && @@ -401,6 +387,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && active == o.active && additional_info == o.additional_info && metadata == o.metadata && @@ -409,13 +396,12 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && holder_id == o.holder_id && - holder == o.holder && + referrer_id == o.referrer_id && object == o.object && - distributions == o.distributions && - deleted == o.deleted && - validation_rules_assignments == o.validation_rules_assignments && publish == o.publish && - redemption == o.redemption + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments end # @see the `==` method @@ -427,7 +413,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, holder, object, distributions, deleted, validation_rules_assignments, publish, redemption].hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_gift.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_gift.rb new file mode 100644 index 00000000..946ab2bf --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class CampaignsVouchersCreateResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_loyalty_card.rb new file mode 100644 index 00000000..ef0f01de --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class CampaignsVouchersCreateResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_publish.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_publish.rb new file mode 100644 index 00000000..5e54ec89 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class CampaignsVouchersCreateResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_redemption.rb b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_redemption.rb new file mode 100644 index 00000000..f2f1e7b6 --- /dev/null +++ b/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class CampaignsVouchersCreateResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/categories_create_request_body.rb b/lib/VoucherifySdk/models/categories_create_request_body.rb index 70cf59b9..e9a19617 100644 --- a/lib/VoucherifySdk/models/categories_create_request_body.rb +++ b/lib/VoucherifySdk/models/categories_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/categories`. + # Request body schema for **POST** `v1/categories`. class CategoriesCreateRequestBody # Category name. attr_accessor :name @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'hierarchy' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CategoriesCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CategoriesCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'hierarchy') self.hierarchy = attributes[:'hierarchy'] - else - self.hierarchy = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @hierarchy.nil? - invalid_properties.push('invalid value for "hierarchy", hierarchy cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @hierarchy.nil? true end diff --git a/lib/VoucherifySdk/models/categories_create_response_body.rb b/lib/VoucherifySdk/models/categories_create_response_body.rb index be086223..b3f073c9 100644 --- a/lib/VoucherifySdk/models/categories_create_response_body.rb +++ b/lib/VoucherifySdk/models/categories_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/categories`. + # Response body schema for **POST** `v1/categories`. class CategoriesCreateResponseBody # Unique category ID assigned by Voucherify. attr_accessor :id @@ -27,7 +27,7 @@ class CategoriesCreateResponseBody attr_accessor :object - # Timestamp representing the date and time when the category was created in ISO 8601 format. + # Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. attr_accessor :created_at class EnumAttributeValidator @@ -82,40 +82,32 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'hierarchy', + :'object', + :'created_at' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CategoriesCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CategoriesCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'hierarchy') self.hierarchy = attributes[:'hierarchy'] - else - self.hierarchy = nil end if attributes.key?(:'object') @@ -126,8 +118,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end end @@ -136,26 +126,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @hierarchy.nil? - invalid_properties.push('invalid value for "hierarchy", hierarchy cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - invalid_properties end @@ -163,26 +133,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @hierarchy.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["category"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["category"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/categories_get_response_body.rb b/lib/VoucherifySdk/models/categories_get_response_body.rb index fda0cec2..7a15dcea 100644 --- a/lib/VoucherifySdk/models/categories_get_response_body.rb +++ b/lib/VoucherifySdk/models/categories_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/categories/{categoryId}`. + # Response body schema for **GET** `v1/categories/{categoryId}`. class CategoriesGetResponseBody # Unique category ID assigned by Voucherify. attr_accessor :id @@ -25,13 +25,13 @@ class CategoriesGetResponseBody # Category hierarchy. attr_accessor :hierarchy - # The type of object represented by the JSON. This object stores information about the category. + # The type of the object represented by the JSON. This object stores information about the category. attr_accessor :object - # Timestamp representing the date and time when the category was created in ISO 8601 format. + # Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the category was updated in ISO 8601 format. + # Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # The type of the stacking rule eligibility. @@ -93,47 +93,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'hierarchy', + :'object', + :'created_at', + :'updated_at', + :'stacking_rules_type' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Category' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CategoriesGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CategoriesGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'hierarchy') self.hierarchy = attributes[:'hierarchy'] - else - self.hierarchy = nil end if attributes.key?(:'object') @@ -144,8 +131,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -162,26 +147,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @hierarchy.nil? - invalid_properties.push('invalid value for "hierarchy", hierarchy cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - invalid_properties end @@ -189,38 +154,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @hierarchy.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["category"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? stacking_rules_type_validator = EnumAttributeValidator.new('String', ["JOINT", "EXCLUSIVE"]) return false unless stacking_rules_type_validator.valid?(@stacking_rules_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["category"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] stacking_rules_type Object to be assigned - def stacking_rules_type=(stacking_rules_type) - validator = EnumAttributeValidator.new('String', ["JOINT", "EXCLUSIVE"]) - unless validator.valid?(stacking_rules_type) - fail ArgumentError, "invalid value for \"stacking_rules_type\", must be one of #{validator.allowable_values}." - end - @stacking_rules_type = stacking_rules_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/categories_list_response_body.rb b/lib/VoucherifySdk/models/categories_list_response_body.rb index 3aa00464..2c953f82 100644 --- a/lib/VoucherifySdk/models/categories_list_response_body.rb +++ b/lib/VoucherifySdk/models/categories_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/categories`. + # Response body schema for **GET** `v1/categories`. class CategoriesListResponseBody - # The type of object represented by JSON. This object stores information about categories in a dictionary. + # The type of the object represented by JSON. This object stores information about categories in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of category objects. @@ -77,21 +77,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CategoriesListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CategoriesListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -111,14 +108,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -127,22 +120,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -150,37 +127,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/categories_update_request_body.rb b/lib/VoucherifySdk/models/categories_update_request_body.rb index 165519b8..f79ab6e0 100644 --- a/lib/VoucherifySdk/models/categories_update_request_body.rb +++ b/lib/VoucherifySdk/models/categories_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **PUT** `/categories/{categoryId}`. + # Request body schema for **PUT** `v1/categories/{categoryId}`. class CategoriesUpdateRequestBody # Category name. attr_accessor :name @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'hierarchy' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CategoriesUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CategoriesUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'hierarchy') self.hierarchy = attributes[:'hierarchy'] - else - self.hierarchy = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @hierarchy.nil? - invalid_properties.push('invalid value for "hierarchy", hierarchy cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @hierarchy.nil? true end diff --git a/lib/VoucherifySdk/models/categories_update_response_body.rb b/lib/VoucherifySdk/models/categories_update_response_body.rb index 9f75933b..20920f8d 100644 --- a/lib/VoucherifySdk/models/categories_update_response_body.rb +++ b/lib/VoucherifySdk/models/categories_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/categories/{categoryId}`. + # Response body schema for **PUT** `v1/categories/{categoryId}`. class CategoriesUpdateResponseBody # Unique category ID assigned by Voucherify. attr_accessor :id @@ -27,10 +27,10 @@ class CategoriesUpdateResponseBody attr_accessor :object - # Timestamp representing the date and time when the category was created in ISO 8601 format. + # Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the category was updated in ISO 8601 format. + # Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at class EnumAttributeValidator @@ -87,40 +87,33 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'hierarchy', + :'object', + :'created_at', + :'updated_at' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CategoriesUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CategoriesUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'hierarchy') self.hierarchy = attributes[:'hierarchy'] - else - self.hierarchy = nil end if attributes.key?(:'object') @@ -131,14 +124,10 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end end @@ -147,30 +136,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @hierarchy.nil? - invalid_properties.push('invalid value for "hierarchy", hierarchy cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @updated_at.nil? - invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') - end - invalid_properties end @@ -178,27 +143,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @hierarchy.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["category"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @updated_at.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["category"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/category.rb b/lib/VoucherifySdk/models/category.rb index 508456a3..6e23b5c2 100644 --- a/lib/VoucherifySdk/models/category.rb +++ b/lib/VoucherifySdk/models/category.rb @@ -25,13 +25,13 @@ class Category # Category hierarchy. attr_accessor :hierarchy - # The type of object represented by the JSON. This object stores information about the category. + # The type of the object represented by the JSON. This object stores information about the category. attr_accessor :object - # Timestamp representing the date and time when the category was created in ISO 8601 format. + # Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the category was updated in ISO 8601 format. + # Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # The type of the stacking rule eligibility. @@ -93,40 +93,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'hierarchy', + :'object', + :'created_at', + :'updated_at', + :'stacking_rules_type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Category` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'hierarchy') self.hierarchy = attributes[:'hierarchy'] - else - self.hierarchy = nil end if attributes.key?(:'object') @@ -137,8 +131,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -155,26 +147,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @hierarchy.nil? - invalid_properties.push('invalid value for "hierarchy", hierarchy cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - invalid_properties end @@ -182,38 +154,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @hierarchy.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["category"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? stacking_rules_type_validator = EnumAttributeValidator.new('String', ["JOINT", "EXCLUSIVE"]) return false unless stacking_rules_type_validator.valid?(@stacking_rules_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["category"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] stacking_rules_type Object to be assigned - def stacking_rules_type=(stacking_rules_type) - validator = EnumAttributeValidator.new('String', ["JOINT", "EXCLUSIVE"]) - unless validator.valid?(stacking_rules_type) - fail ArgumentError, "invalid value for \"stacking_rules_type\", must be one of #{validator.allowable_values}." - end - @stacking_rules_type = stacking_rules_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/client_events_create_request_body.rb b/lib/VoucherifySdk/models/client_events_create_request_body.rb index c4af2345..65ecc79a 100644 --- a/lib/VoucherifySdk/models/client_events_create_request_body.rb +++ b/lib/VoucherifySdk/models/client_events_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/events`. + # Request body schema for **POST** `v1/events`. class ClientEventsCreateRequestBody # Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. attr_accessor :event @@ -58,28 +58,23 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'event', + :'referral', + :'loyalty', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientEventsCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientEventsCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'event') self.event = attributes[:'event'] - else - self.event = nil end if attributes.key?(:'customer') @@ -106,15 +101,11 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @event.nil? - invalid_properties.push('invalid value for "event", event cannot be nil.') - end - - if @event.to_s.length > 300 + if !@event.nil? && @event.to_s.length > 300 invalid_properties.push('invalid value for "event", the character length must be smaller than or equal to 300.') end - if @event.to_s.length < 1 + if !@event.nil? && @event.to_s.length < 1 invalid_properties.push('invalid value for "event", the character length must be great than or equal to 1.') end @@ -129,31 +120,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @event.nil? - return false if @event.to_s.length > 300 - return false if @event.to_s.length < 1 + return false if !@event.nil? && @event.to_s.length > 300 + return false if !@event.nil? && @event.to_s.length < 1 return false if @customer.nil? true end - # Custom attribute writer method with validation - # @param [Object] event Value to be assigned - def event=(event) - if event.nil? - fail ArgumentError, 'event cannot be nil' - end - - if event.to_s.length > 300 - fail ArgumentError, 'invalid value for "event", the character length must be smaller than or equal to 300.' - end - - if event.to_s.length < 1 - fail ArgumentError, 'invalid value for "event", the character length must be great than or equal to 1.' - end - - @event = event - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/client_events_create_request_body_loyalty.rb b/lib/VoucherifySdk/models/client_events_create_request_body_loyalty.rb index 14af252f..bfa588ca 100644 --- a/lib/VoucherifySdk/models/client_events_create_request_body_loyalty.rb +++ b/lib/VoucherifySdk/models/client_events_create_request_body_loyalty.rb @@ -41,28 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientEventsCreateRequestBodyLoyalty` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientEventsCreateRequestBodyLoyalty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end end @@ -71,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - invalid_properties end @@ -82,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? true end diff --git a/lib/VoucherifySdk/models/client_events_create_request_body_referral.rb b/lib/VoucherifySdk/models/client_events_create_request_body_referral.rb index c04bd7fd..b1dd4825 100644 --- a/lib/VoucherifySdk/models/client_events_create_request_body_referral.rb +++ b/lib/VoucherifySdk/models/client_events_create_request_body_referral.rb @@ -46,28 +46,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code', + :'referrer_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientEventsCreateRequestBodyReferral` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientEventsCreateRequestBodyReferral`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end if attributes.key?(:'referrer_id') @@ -80,10 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - invalid_properties end @@ -91,7 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? true end diff --git a/lib/VoucherifySdk/models/client_events_create_response_body.rb b/lib/VoucherifySdk/models/client_events_create_response_body.rb index 6f96400d..08e4dc56 100644 --- a/lib/VoucherifySdk/models/client_events_create_response_body.rb +++ b/lib/VoucherifySdk/models/client_events_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/events`. + # Response body schema for **POST** `v1/events`. class ClientEventsCreateResponseBody # The object represented is an `event`. attr_accessor :object @@ -30,6 +30,8 @@ class ClientEventsCreateResponseBody # A `null` loyalty object. attr_accessor :loyalty + attr_accessor :metadata + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -59,7 +61,8 @@ def self.attribute_map :'type' => :'type', :'customer' => :'customer', :'referral' => :'referral', - :'loyalty' => :'loyalty' + :'loyalty' => :'loyalty', + :'metadata' => :'metadata' } end @@ -75,30 +78,27 @@ def self.openapi_types :'type' => :'String', :'customer' => :'SimpleCustomerRequiredObjectType', :'referral' => :'Object', - :'loyalty' => :'Object' + :'loyalty' => :'Object', + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'type', :'referral', - :'loyalty' + :'loyalty', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientEventsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientEventsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -110,8 +110,6 @@ def initialize(attributes = {}) if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'customer') @@ -122,14 +120,14 @@ def initialize(attributes = {}) if attributes.key?(:'referral') self.referral = attributes[:'referral'] - else - self.referral = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] end end @@ -138,14 +136,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - if @customer.nil? invalid_properties.push('invalid value for "customer", customer cannot be nil.') end @@ -157,24 +147,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["event"]) return false unless object_validator.valid?(@object) - return false if @type.nil? return false if @customer.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["event"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -184,7 +162,8 @@ def ==(o) type == o.type && customer == o.customer && referral == o.referral && - loyalty == o.loyalty + loyalty == o.loyalty && + metadata == o.metadata end # @see the `==` method @@ -196,7 +175,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [object, type, customer, referral, loyalty].hash + [object, type, customer, referral, loyalty, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/client_promotions_tiers_list_response_body.rb b/lib/VoucherifySdk/models/client_promotions_tiers_list_response_body.rb new file mode 100644 index 00000000..984749a2 --- /dev/null +++ b/lib/VoucherifySdk/models/client_promotions_tiers_list_response_body.rb @@ -0,0 +1,260 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/client/v1/promotions/tiers`. + class ClientPromotionsTiersListResponseBody + # The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of promotion tier objects. + attr_accessor :data_ref + + # Contains array of promotion tier objects. + attr_accessor :tiers + + # Total number of promotion tiers. + attr_accessor :total + + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. + attr_accessor :has_more + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'tiers' => :'tiers', + :'total' => :'total', + :'has_more' => :'has_more' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'tiers' => :'Array', + :'total' => :'Integer', + :'has_more' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'tiers', + :'total', + :'has_more' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'tiers' + end + + if attributes.key?(:'tiers') + if (value = attributes[:'tiers']).is_a?(Array) + self.tiers = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + tiers == o.tiers && + total == o.total && + has_more == o.has_more + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, tiers, total, has_more].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_qualifications_check_eligibility_request_body.rb b/lib/VoucherifySdk/models/client_qualifications_check_eligibility_request_body.rb index 88ee5290..a38f461d 100644 --- a/lib/VoucherifySdk/models/client_qualifications_check_eligibility_request_body.rb +++ b/lib/VoucherifySdk/models/client_qualifications_check_eligibility_request_body.rb @@ -14,19 +14,16 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/qualifications`. + # Request body schema for **POST** `v1/qualifications`. class ClientQualificationsCheckEligibilityRequestBody attr_accessor :customer attr_accessor :order - # Defines which resources Voucherify will use. The `ADVANCED` mode is available after purchase only. - attr_accessor :mode - # Is correspondent to Customer's source_id attr_accessor :tracking_id - # Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). + # Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). attr_accessor :scenario attr_accessor :options @@ -61,7 +58,6 @@ def self.attribute_map { :'customer' => :'customer', :'order' => :'order', - :'mode' => :'mode', :'tracking_id' => :'tracking_id', :'scenario' => :'scenario', :'options' => :'options', @@ -79,7 +75,6 @@ def self.openapi_types { :'customer' => :'Customer', :'order' => :'Order', - :'mode' => :'String', :'tracking_id' => :'String', :'scenario' => :'String', :'options' => :'QualificationsOption', @@ -90,21 +85,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'tracking_id', + :'scenario', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientQualificationsCheckEligibilityRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientQualificationsCheckEligibilityRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -116,10 +107,6 @@ def initialize(attributes = {}) self.order = attributes[:'order'] end - if attributes.key?(:'mode') - self.mode = attributes[:'mode'] - end - if attributes.key?(:'tracking_id') self.tracking_id = attributes[:'tracking_id'] end @@ -149,33 +136,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - mode_validator = EnumAttributeValidator.new('String', ["BASIC", "ADVANCED"]) - return false unless mode_validator.valid?(@mode) scenario_validator = EnumAttributeValidator.new('String', ["ALL", "CUSTOMER_WALLET", "AUDIENCE_ONLY", "PRODUCTS", "PRODUCTS_DISCOUNT", "PROMOTION_STACKS", "PRODUCTS_BY_CUSTOMER", "PRODUCTS_DISCOUNT_BY_CUSTOMER"]) return false unless scenario_validator.valid?(@scenario) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] mode Object to be assigned - def mode=(mode) - validator = EnumAttributeValidator.new('String', ["BASIC", "ADVANCED"]) - unless validator.valid?(mode) - fail ArgumentError, "invalid value for \"mode\", must be one of #{validator.allowable_values}." - end - @mode = mode - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] scenario Object to be assigned - def scenario=(scenario) - validator = EnumAttributeValidator.new('String', ["ALL", "CUSTOMER_WALLET", "AUDIENCE_ONLY", "PRODUCTS", "PRODUCTS_DISCOUNT", "PROMOTION_STACKS", "PRODUCTS_BY_CUSTOMER", "PRODUCTS_DISCOUNT_BY_CUSTOMER"]) - unless validator.valid?(scenario) - fail ArgumentError, "invalid value for \"scenario\", must be one of #{validator.allowable_values}." - end - @scenario = scenario - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -183,7 +148,6 @@ def ==(o) self.class == o.class && customer == o.customer && order == o.order && - mode == o.mode && tracking_id == o.tracking_id && scenario == o.scenario && options == o.options && @@ -199,7 +163,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [customer, order, mode, tracking_id, scenario, options, metadata].hash + [customer, order, tracking_id, scenario, options, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/client_qualifications_check_eligibility_response_body.rb b/lib/VoucherifySdk/models/client_qualifications_check_eligibility_response_body.rb index 2111dd2d..e00a3ea0 100644 --- a/lib/VoucherifySdk/models/client_qualifications_check_eligibility_response_body.rb +++ b/lib/VoucherifySdk/models/client_qualifications_check_eligibility_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/qualifications`. + # Response body schema for **POST** `v1/qualifications`. class ClientQualificationsCheckEligibilityResponseBody attr_accessor :redeemables @@ -53,21 +53,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'tracking_id', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientQualificationsCheckEligibilityResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientQualificationsCheckEligibilityResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body.rb index 86588767..146a9774 100644 --- a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body.rb +++ b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body.rb @@ -14,9 +14,10 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/redemptions`. + # Response body schema for **POST** `v1/redemptions`. class ClientRedemptionsRedeemRequestBody - # An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. + attr_accessor :options + attr_accessor :redeemables attr_accessor :order @@ -31,18 +32,16 @@ class ClientRedemptionsRedeemRequestBody # A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. attr_accessor :metadata - attr_accessor :options - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'options' => :'options', :'redeemables' => :'redeemables', :'order' => :'order', :'customer' => :'customer', :'session' => :'session', :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'options' => :'options' + :'metadata' => :'metadata' } end @@ -54,50 +53,42 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'redeemables' => :'Array', + :'options' => :'ClientRedemptionsRedeemRequestBodyOptions', + :'redeemables' => :'Array', :'order' => :'Order', :'customer' => :'Customer', :'session' => :'Session', :'tracking_id' => :'String', - :'metadata' => :'Object', - :'options' => :'ClientRedemptionsRedeemRequestBodyAllOfOptions' + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'options', + :'redeemables', + :'tracking_id', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'StackableValidateRedeemBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientRedemptionsRedeemRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientRedemptionsRedeemRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + if attributes.key?(:'redeemables') if (value = attributes[:'redeemables']).is_a?(Array) self.redeemables = value end - else - self.redeemables = nil end if attributes.key?(:'order') @@ -119,10 +110,6 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'options') - self.options = attributes[:'options'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -130,18 +117,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') - end - - if @redeemables.length > 5 - invalid_properties.push('invalid value for "redeemables", number of items must be less than or equal to 5.') - end - - if @redeemables.length < 1 - invalid_properties.push('invalid value for "redeemables", number of items must be greater than or equal to 1.') - end - invalid_properties end @@ -149,42 +124,21 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemables.nil? - return false if @redeemables.length > 5 - return false if @redeemables.length < 1 true end - # Custom attribute writer method with validation - # @param [Object] redeemables Value to be assigned - def redeemables=(redeemables) - if redeemables.nil? - fail ArgumentError, 'redeemables cannot be nil' - end - - if redeemables.length > 5 - fail ArgumentError, 'invalid value for "redeemables", number of items must be less than or equal to 5.' - end - - if redeemables.length < 1 - fail ArgumentError, 'invalid value for "redeemables", number of items must be greater than or equal to 1.' - end - - @redeemables = redeemables - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + options == o.options && redeemables == o.redeemables && order == o.order && customer == o.customer && session == o.session && tracking_id == o.tracking_id && - metadata == o.metadata && - options == o.options + metadata == o.metadata end # @see the `==` method @@ -196,7 +150,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [redeemables, order, customer, session, tracking_id, metadata, options].hash + [options, redeemables, order, customer, session, tracking_id, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_all_of_options.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_all_of_options.rb deleted file mode 100644 index 54d45ee9..00000000 --- a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_all_of_options.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Configure parameters returned in the response. - class ClientRedemptionsRedeemRequestBodyAllOfOptions - # Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. | - attr_accessor :expand - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'expand' => :'expand' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'expand' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientRedemptionsRedeemRequestBodyAllOfOptions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientRedemptionsRedeemRequestBodyAllOfOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'expand') - if (value = attributes[:'expand']).is_a?(Array) - self.expand = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - expand == o.expand - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [expand].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_options.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_options.rb new file mode 100644 index 00000000..7dfdebcb --- /dev/null +++ b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_options.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Configure parameters returned in the response. + class ClientRedemptionsRedeemRequestBodyOptions + # Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. | + attr_accessor :expand + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expand' => :'expand' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expand' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'expand' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'expand') + if (value = attributes[:'expand']).is_a?(Array) + self.expand = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expand == o.expand + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expand].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item.rb new file mode 100644 index 00000000..437ade15 --- /dev/null +++ b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item.rb @@ -0,0 +1,260 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientRedemptionsRedeemRequestBodyRedeemablesItem + attr_accessor :object + + attr_accessor :id + + attr_accessor :gift + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'id' => :'id', + :'gift' => :'gift', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'id' => :'String', + :'gift' => :'ClientRedemptionsRedeemRequestBodyRedeemablesItemGift', + :'reward' => :'ClientRedemptionsRedeemRequestBodyRedeemablesItemReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'gift', + :'reward' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "promotion_stack"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + id == o.id && + gift == o.gift && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, id, gift, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_gift.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_gift.rb new file mode 100644 index 00000000..4286e336 --- /dev/null +++ b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information on the number of gift card credits that the customer wants to apply to the order. + class ClientRedemptionsRedeemRequestBodyRedeemablesItemGift + # The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + attr_accessor :credits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credits' => :'credits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credits' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'credits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'credits') + self.credits = attributes[:'credits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credits == o.credits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_reward.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_reward.rb new file mode 100644 index 00000000..e1dadedb --- /dev/null +++ b/lib/VoucherifySdk/models/client_redemptions_redeem_request_body_redeemables_item_reward.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + class ClientRedemptionsRedeemRequestBodyRedeemablesItemReward + # Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + attr_accessor :id + + # The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_redemptions_redeem_response_body.rb b/lib/VoucherifySdk/models/client_redemptions_redeem_response_body.rb index b65b0c8c..1b208024 100644 --- a/lib/VoucherifySdk/models/client_redemptions_redeem_response_body.rb +++ b/lib/VoucherifySdk/models/client_redemptions_redeem_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/redemptions`. + # Response body schema for **POST** `v1/redemptions`. class ClientRedemptionsRedeemResponseBody attr_accessor :redemptions @@ -58,21 +58,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'redemptions', + :'inapplicable_redeemables', + :'skipped_redeemables' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientRedemptionsRedeemResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientRedemptionsRedeemResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/client_validations_validate_request_body.rb b/lib/VoucherifySdk/models/client_validations_validate_request_body.rb index 6193ab31..99bf3e77 100644 --- a/lib/VoucherifySdk/models/client_validations_validate_request_body.rb +++ b/lib/VoucherifySdk/models/client_validations_validate_request_body.rb @@ -14,9 +14,10 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/validations`. + # Response body schema for **POST** `v1/validations`. class ClientValidationsValidateRequestBody - # An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. + attr_accessor :options + attr_accessor :redeemables attr_accessor :order @@ -31,18 +32,16 @@ class ClientValidationsValidateRequestBody # A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. attr_accessor :metadata - attr_accessor :options - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'options' => :'options', :'redeemables' => :'redeemables', :'order' => :'order', :'customer' => :'customer', :'session' => :'session', :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'options' => :'options' + :'metadata' => :'metadata' } end @@ -54,50 +53,42 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'redeemables' => :'Array', + :'options' => :'ClientValidationsValidateRequestBodyOptions', + :'redeemables' => :'Array', :'order' => :'Order', :'customer' => :'Customer', :'session' => :'Session', :'tracking_id' => :'String', - :'metadata' => :'Object', - :'options' => :'ClientValidationsValidateRequestBodyAllOfOptions' + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'options', + :'redeemables', + :'tracking_id', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'StackableValidateRedeemBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientValidationsValidateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientValidationsValidateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + if attributes.key?(:'redeemables') if (value = attributes[:'redeemables']).is_a?(Array) self.redeemables = value end - else - self.redeemables = nil end if attributes.key?(:'order') @@ -119,10 +110,6 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'options') - self.options = attributes[:'options'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -130,18 +117,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') - end - - if @redeemables.length > 5 - invalid_properties.push('invalid value for "redeemables", number of items must be less than or equal to 5.') - end - - if @redeemables.length < 1 - invalid_properties.push('invalid value for "redeemables", number of items must be greater than or equal to 1.') - end - invalid_properties end @@ -149,42 +124,21 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemables.nil? - return false if @redeemables.length > 5 - return false if @redeemables.length < 1 true end - # Custom attribute writer method with validation - # @param [Object] redeemables Value to be assigned - def redeemables=(redeemables) - if redeemables.nil? - fail ArgumentError, 'redeemables cannot be nil' - end - - if redeemables.length > 5 - fail ArgumentError, 'invalid value for "redeemables", number of items must be less than or equal to 5.' - end - - if redeemables.length < 1 - fail ArgumentError, 'invalid value for "redeemables", number of items must be greater than or equal to 1.' - end - - @redeemables = redeemables - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + options == o.options && redeemables == o.redeemables && order == o.order && customer == o.customer && session == o.session && tracking_id == o.tracking_id && - metadata == o.metadata && - options == o.options + metadata == o.metadata end # @see the `==` method @@ -196,7 +150,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [redeemables, order, customer, session, tracking_id, metadata, options].hash + [options, redeemables, order, customer, session, tracking_id, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/client_validations_validate_request_body_all_of_options.rb b/lib/VoucherifySdk/models/client_validations_validate_request_body_all_of_options.rb deleted file mode 100644 index a17879bc..00000000 --- a/lib/VoucherifySdk/models/client_validations_validate_request_body_all_of_options.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Configure parameters returned in the response. - class ClientValidationsValidateRequestBodyAllOfOptions - # The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | - attr_accessor :expand - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'expand' => :'expand' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'expand' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientValidationsValidateRequestBodyAllOfOptions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientValidationsValidateRequestBodyAllOfOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'expand') - if (value = attributes[:'expand']).is_a?(Array) - self.expand = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - expand == o.expand - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [expand].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/client_validations_validate_request_body_options.rb b/lib/VoucherifySdk/models/client_validations_validate_request_body_options.rb new file mode 100644 index 00000000..3b616ed2 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_request_body_options.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Configure parameters returned in the response. + class ClientValidationsValidateRequestBodyOptions + # The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | + attr_accessor :expand + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expand' => :'expand' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expand' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'expand' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'expand') + if (value = attributes[:'expand']).is_a?(Array) + self.expand = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expand == o.expand + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expand].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item.rb b/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item.rb new file mode 100644 index 00000000..1f95f949 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item.rb @@ -0,0 +1,260 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateRequestBodyRedeemablesItem + attr_accessor :object + + attr_accessor :id + + attr_accessor :gift + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'id' => :'id', + :'gift' => :'gift', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'id' => :'String', + :'gift' => :'ClientValidationsValidateRequestBodyRedeemablesItemGift', + :'reward' => :'ClientValidationsValidateRequestBodyRedeemablesItemReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'gift', + :'reward' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "promotion_stack"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + id == o.id && + gift == o.gift && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, id, gift, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_gift.rb b/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_gift.rb new file mode 100644 index 00000000..c819ee16 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information on the number of gift card credits that the customer wants to apply to the order. + class ClientValidationsValidateRequestBodyRedeemablesItemGift + # The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + attr_accessor :credits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credits' => :'credits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credits' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'credits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'credits') + self.credits = attributes[:'credits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credits == o.credits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_reward.rb b/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_reward.rb new file mode 100644 index 00000000..a6a33f86 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_request_body_redeemables_item_reward.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + class ClientValidationsValidateRequestBodyRedeemablesItemReward + # Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + attr_accessor :id + + # The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body.rb index b0ea8d40..bbdf2b3f 100644 --- a/lib/VoucherifySdk/models/client_validations_validate_response_body.rb +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body.rb @@ -19,7 +19,6 @@ class ClientValidationsValidateResponseBody # The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. attr_accessor :valid - # Lists validation results of each redeemable. If redeemables_application_mode=\"PARTIAL\" all redeemables here will be \"APPLICABLE\" attr_accessor :redeemables # Lists validation results of each skipped redeemable. @@ -35,6 +34,8 @@ class ClientValidationsValidateResponseBody attr_accessor :session + attr_accessor :stacking_rules + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -44,7 +45,8 @@ def self.attribute_map :'inapplicable_redeemables' => :'inapplicable_redeemables', :'order' => :'order', :'tracking_id' => :'tracking_id', - :'session' => :'session' + :'session' => :'session', + :'stacking_rules' => :'stacking_rules' } end @@ -57,55 +59,43 @@ def self.acceptable_attributes def self.openapi_types { :'valid' => :'Boolean', - :'redeemables' => :'Array', - :'skipped_redeemables' => :'Array', + :'redeemables' => :'Array', + :'skipped_redeemables' => :'Array', :'inapplicable_redeemables' => :'Array', :'order' => :'OrderCalculated', :'tracking_id' => :'String', - :'session' => :'Session' + :'session' => :'Session', + :'stacking_rules' => :'StackingRules' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'valid', + :'redeemables', + :'skipped_redeemables', + :'inapplicable_redeemables', + :'tracking_id', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationsValidateResponseBody' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ClientValidationsValidateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ClientValidationsValidateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'valid') self.valid = attributes[:'valid'] - else - self.valid = nil end if attributes.key?(:'redeemables') if (value = attributes[:'redeemables']).is_a?(Array) self.redeemables = value end - else - self.redeemables = nil end if attributes.key?(:'skipped_redeemables') @@ -131,6 +121,12 @@ def initialize(attributes = {}) if attributes.key?(:'session') self.session = attributes[:'session'] end + + if attributes.key?(:'stacking_rules') + self.stacking_rules = attributes[:'stacking_rules'] + else + self.stacking_rules = nil + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -138,12 +134,8 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @valid.nil? - invalid_properties.push('invalid value for "valid", valid cannot be nil.') - end - - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') + if @stacking_rules.nil? + invalid_properties.push('invalid value for "stacking_rules", stacking_rules cannot be nil.') end invalid_properties @@ -153,8 +145,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @valid.nil? - return false if @redeemables.nil? + return false if @stacking_rules.nil? true end @@ -169,7 +160,8 @@ def ==(o) inapplicable_redeemables == o.inapplicable_redeemables && order == o.order && tracking_id == o.tracking_id && - session == o.session + session == o.session && + stacking_rules == o.stacking_rules end # @see the `==` method @@ -181,7 +173,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [valid, redeemables, skipped_redeemables, inapplicable_redeemables, order, tracking_id, session].hash + [valid, redeemables, skipped_redeemables, inapplicable_redeemables, order, tracking_id, session, stacking_rules].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item.rb new file mode 100644 index 00000000..6f41f35e --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item.rb @@ -0,0 +1,312 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateResponseBodyRedeemablesItem + attr_accessor :status + + # Redeemable ID, i.e. the voucher code. + attr_accessor :id + + # Redeemable's object type. + attr_accessor :object + + attr_accessor :order + + attr_accessor :applicable_to + + attr_accessor :inapplicable_to + + attr_accessor :result + + attr_accessor :metadata + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'id' => :'id', + :'object' => :'object', + :'order' => :'order', + :'applicable_to' => :'applicable_to', + :'inapplicable_to' => :'inapplicable_to', + :'result' => :'result', + :'metadata' => :'metadata', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String', + :'id' => :'String', + :'object' => :'String', + :'order' => :'OrderCalculated', + :'applicable_to' => :'ApplicableToResultList', + :'inapplicable_to' => :'InapplicableToResultList', + :'result' => :'ClientValidationsValidateResponseBodyRedeemablesItemResult', + :'metadata' => :'Object', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'applicable_to') + self.applicable_to = attributes[:'applicable_to'] + end + + if attributes.key?(:'inapplicable_to') + self.inapplicable_to = attributes[:'inapplicable_to'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["APPLICABLE", "INAPPLICABLE", "SKIPPED"]) + return false unless status_validator.valid?(@status) + object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + id == o.id && + object == o.object && + order == o.order && + applicable_to == o.applicable_to && + inapplicable_to == o.inapplicable_to && + result == o.result && + metadata == o.metadata && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status, id, object, order, applicable_to, inapplicable_to, result, metadata, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result.rb new file mode 100644 index 00000000..0d852dad --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result.rb @@ -0,0 +1,244 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateResponseBodyRedeemablesItemResult + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + attr_accessor :error + + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'error' => :'error', + :'details' => :'details' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount', + :'gift' => :'ClientValidationsValidateResponseBodyRedeemablesItemResultGift', + :'loyalty_card' => :'ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard', + :'error' => :'Error', + :'details' => :'ClientValidationsValidateResponseBodyRedeemablesItemResultDetails' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'gift', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'details') + self.details = attributes[:'details'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + error == o.error && + details == o.details + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount, gift, loyalty_card, error, details].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_details.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_details.rb new file mode 100644 index 00000000..e48601e7 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_details.rb @@ -0,0 +1,216 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateResponseBodyRedeemablesItemResultDetails + attr_accessor :key + + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'key' => :'key', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'key' => :'String', + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [key, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount.rb new file mode 100644 index 00000000..041581e0 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount.rb @@ -0,0 +1,400 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount + attr_accessor :type + + # Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. + attr_accessor :amount_off + + attr_accessor :amount_off_formula + + # Maximum discount amount per order. + attr_accessor :aggregated_amount_limit + + attr_accessor :effect + + # Flag indicating whether the discount was calculated using a formula. + attr_accessor :is_dynamic + + # Number of units to be granted a full value discount. + attr_accessor :unit_off + + attr_accessor :unit_off_formula + + # The product deemed as free, chosen from product inventory (e.g. time, items). + attr_accessor :unit_type + + attr_accessor :product + + attr_accessor :sku + + attr_accessor :units + + # The percent discount that the customer will receive. + attr_accessor :percent_off + + attr_accessor :percent_off_formula + + # Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + attr_accessor :amount_limit + + # Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. + attr_accessor :fixed_amount + + attr_accessor :fixed_amount_formula + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'amount_off' => :'amount_off', + :'amount_off_formula' => :'amount_off_formula', + :'aggregated_amount_limit' => :'aggregated_amount_limit', + :'effect' => :'effect', + :'is_dynamic' => :'is_dynamic', + :'unit_off' => :'unit_off', + :'unit_off_formula' => :'unit_off_formula', + :'unit_type' => :'unit_type', + :'product' => :'product', + :'sku' => :'sku', + :'units' => :'units', + :'percent_off' => :'percent_off', + :'percent_off_formula' => :'percent_off_formula', + :'amount_limit' => :'amount_limit', + :'fixed_amount' => :'fixed_amount', + :'fixed_amount_formula' => :'fixed_amount_formula' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'amount_off' => :'Float', + :'amount_off_formula' => :'String', + :'aggregated_amount_limit' => :'Integer', + :'effect' => :'String', + :'is_dynamic' => :'Boolean', + :'unit_off' => :'Integer', + :'unit_off_formula' => :'String', + :'unit_type' => :'String', + :'product' => :'ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct', + :'sku' => :'SimpleSkuDiscountUnit', + :'units' => :'Array', + :'percent_off' => :'Float', + :'percent_off_formula' => :'String', + :'amount_limit' => :'Float', + :'fixed_amount' => :'Float', + :'fixed_amount_formula' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount_off', + :'amount_off_formula', + :'aggregated_amount_limit', + :'is_dynamic', + :'unit_off', + :'unit_off_formula', + :'unit_type', + :'units', + :'percent_off', + :'percent_off_formula', + :'amount_limit', + :'fixed_amount', + :'fixed_amount_formula' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'amount_off') + self.amount_off = attributes[:'amount_off'] + end + + if attributes.key?(:'amount_off_formula') + self.amount_off_formula = attributes[:'amount_off_formula'] + end + + if attributes.key?(:'aggregated_amount_limit') + self.aggregated_amount_limit = attributes[:'aggregated_amount_limit'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + + if attributes.key?(:'is_dynamic') + self.is_dynamic = attributes[:'is_dynamic'] + end + + if attributes.key?(:'unit_off') + self.unit_off = attributes[:'unit_off'] + end + + if attributes.key?(:'unit_off_formula') + self.unit_off_formula = attributes[:'unit_off_formula'] + end + + if attributes.key?(:'unit_type') + self.unit_type = attributes[:'unit_type'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'units') + if (value = attributes[:'units']).is_a?(Array) + self.units = value + end + end + + if attributes.key?(:'percent_off') + self.percent_off = attributes[:'percent_off'] + end + + if attributes.key?(:'percent_off_formula') + self.percent_off_formula = attributes[:'percent_off_formula'] + end + + if attributes.key?(:'amount_limit') + self.amount_limit = attributes[:'amount_limit'] + end + + if attributes.key?(:'fixed_amount') + self.fixed_amount = attributes[:'fixed_amount'] + end + + if attributes.key?(:'fixed_amount_formula') + self.fixed_amount_formula = attributes[:'fixed_amount_formula'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AMOUNT", "UNIT", "PERCENT", "FIXED"]) + return false unless type_validator.valid?(@type) + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS", "APPLY_TO_ITEMS_PROPORTIONALLY", "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", "APPLY_TO_ITEMS_BY_QUANTITY", "ADD_MISSING_ITEMS", "ADD_NEW_ITEMS", "ADD_MANY_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + amount_off == o.amount_off && + amount_off_formula == o.amount_off_formula && + aggregated_amount_limit == o.aggregated_amount_limit && + effect == o.effect && + is_dynamic == o.is_dynamic && + unit_off == o.unit_off && + unit_off_formula == o.unit_off_formula && + unit_type == o.unit_type && + product == o.product && + sku == o.sku && + units == o.units && + percent_off == o.percent_off && + percent_off_formula == o.percent_off_formula && + amount_limit == o.amount_limit && + fixed_amount == o.fixed_amount && + fixed_amount_formula == o.fixed_amount_formula + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, amount_off, amount_off_formula, aggregated_amount_limit, effect, is_dynamic, unit_off, unit_off_formula, unit_type, product, sku, units, percent_off, percent_off_formula, amount_limit, fixed_amount, fixed_amount_formula].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount_product.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount_product.rb new file mode 100644 index 00000000..a6dd9869 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount_product.rb @@ -0,0 +1,231 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + # Unique product ID, assigned by Voucherify. + attr_accessor :id + + # Product's source ID. + attr_accessor :source_id + + # Product name. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'name' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_gift.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_gift.rb new file mode 100644 index 00000000..a5e33638 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores the amount of gift card credits to be applied in the redemption. + class ClientValidationsValidateResponseBodyRedeemablesItemResultGift + # Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). + attr_accessor :credits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credits' => :'credits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credits' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'credits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'credits') + self.credits = attributes[:'credits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credits == o.credits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card.rb b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card.rb new file mode 100644 index 00000000..83ac85e4 --- /dev/null +++ b/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + # Total number of loyalty points to be applied in the redemption. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/code_config.rb b/lib/VoucherifySdk/models/code_config.rb index b942fe8d..cf0a20a3 100644 --- a/lib/VoucherifySdk/models/code_config.rb +++ b/lib/VoucherifySdk/models/code_config.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Schema containing information about config used for voucher. Defines code's pattern (prefix, suffix, length, charset, etc). + # Contains information about the config used for the voucher code. Defines the code's pattern (prefix, postfix, length, charset, etc). class CodeConfig # Number of characters in a generated code (excluding prefix and postfix). attr_accessor :length @@ -31,7 +31,7 @@ class CodeConfig # A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. attr_accessor :pattern - # The initial count + # Internal value, does not change anything if provided. attr_accessor :initial_count # Attribute mapping from ruby-style variable name to JSON key. @@ -66,21 +66,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'length', + :'charset', + :'prefix', + :'postfix', + :'pattern', + :'initial_count' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CodeConfig` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CodeConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/code_config_required_length_charset_pattern.rb b/lib/VoucherifySdk/models/code_config_required_length_charset_pattern.rb deleted file mode 100644 index f7440a01..00000000 --- a/lib/VoucherifySdk/models/code_config_required_length_charset_pattern.rb +++ /dev/null @@ -1,293 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CodeConfigRequiredLengthCharsetPattern - # Number of characters in a generated code (excluding prefix and postfix). - attr_accessor :length - - # Characters that can appear in the code. Examples: - Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` - Numbers: `0123456789` - Custom: a custom character set - attr_accessor :charset - - # A text appended before the code. - attr_accessor :prefix - - # A text appended after the code. - attr_accessor :postfix - - # A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. - attr_accessor :pattern - - # The initial count - attr_accessor :initial_count - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'length' => :'length', - :'charset' => :'charset', - :'prefix' => :'prefix', - :'postfix' => :'postfix', - :'pattern' => :'pattern', - :'initial_count' => :'initial_count' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'length' => :'Float', - :'charset' => :'String', - :'prefix' => :'String', - :'postfix' => :'String', - :'pattern' => :'String', - :'initial_count' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CodeConfig' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CodeConfigRequiredLengthCharsetPattern` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CodeConfigRequiredLengthCharsetPattern`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'length') - self.length = attributes[:'length'] - else - self.length = nil - end - - if attributes.key?(:'charset') - self.charset = attributes[:'charset'] - else - self.charset = nil - end - - if attributes.key?(:'prefix') - self.prefix = attributes[:'prefix'] - end - - if attributes.key?(:'postfix') - self.postfix = attributes[:'postfix'] - end - - if attributes.key?(:'pattern') - self.pattern = attributes[:'pattern'] - else - self.pattern = nil - end - - if attributes.key?(:'initial_count') - self.initial_count = attributes[:'initial_count'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @length.nil? - invalid_properties.push('invalid value for "length", length cannot be nil.') - end - - if @charset.nil? - invalid_properties.push('invalid value for "charset", charset cannot be nil.') - end - - if @pattern.nil? - invalid_properties.push('invalid value for "pattern", pattern cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @length.nil? - return false if @charset.nil? - return false if @pattern.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - length == o.length && - charset == o.charset && - prefix == o.prefix && - postfix == o.postfix && - pattern == o.pattern && - initial_count == o.initial_count - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [length, charset, prefix, postfix, pattern, initial_count].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/create_publication_base.rb b/lib/VoucherifySdk/models/create_publication_base.rb deleted file mode 100644 index b6358904..00000000 --- a/lib/VoucherifySdk/models/create_publication_base.rb +++ /dev/null @@ -1,242 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Create publication - class CreatePublicationBase - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. - attr_accessor :source_id - - attr_accessor :customer - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'source_id' => :'source_id', - :'customer' => :'customer', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'source_id' => :'String', - :'customer' => :'Customer', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CreatePublicationBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CreatePublicationBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - source_id == o.source_id && - customer == o.customer && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [source_id, customer, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/create_publication_campaign.rb b/lib/VoucherifySdk/models/create_publication_campaign.rb index 9932d883..486c0a35 100644 --- a/lib/VoucherifySdk/models/create_publication_campaign.rb +++ b/lib/VoucherifySdk/models/create_publication_campaign.rb @@ -46,28 +46,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'count' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CreatePublicationCampaign` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CreatePublicationCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'count') @@ -80,10 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - if !@count.nil? && @count > 20 invalid_properties.push('invalid value for "count", must be smaller than or equal to 20.') end @@ -99,30 +88,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? return false if !@count.nil? && @count > 20 return false if !@count.nil? && @count < 1 true end - # Custom attribute writer method with validation - # @param [Object] count Value to be assigned - def count=(count) - if count.nil? - fail ArgumentError, 'count cannot be nil' - end - - if count > 20 - fail ArgumentError, 'invalid value for "count", must be smaller than or equal to 20.' - end - - if count < 1 - fail ArgumentError, 'invalid value for "count", must be greater than or equal to 1.' - end - - @count = count - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/create_publication_with_campaign.rb b/lib/VoucherifySdk/models/create_publication_with_campaign.rb deleted file mode 100644 index a779588a..00000000 --- a/lib/VoucherifySdk/models/create_publication_with_campaign.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Create publication with campaign. - class CreatePublicationWithCampaign - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. - attr_accessor :source_id - - attr_accessor :customer - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - attr_accessor :campaign - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'source_id' => :'source_id', - :'customer' => :'customer', - :'metadata' => :'metadata', - :'campaign' => :'campaign' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'source_id' => :'String', - :'customer' => :'Customer', - :'metadata' => :'Object', - :'campaign' => :'CreatePublicationCampaign' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CreatePublicationBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CreatePublicationWithCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CreatePublicationWithCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - else - self.campaign = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @campaign.nil? - invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer.nil? - return false if @campaign.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - source_id == o.source_id && - customer == o.customer && - metadata == o.metadata && - campaign == o.campaign - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [source_id, customer, metadata, campaign].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/create_publication_with_specific_voucher.rb b/lib/VoucherifySdk/models/create_publication_with_specific_voucher.rb deleted file mode 100644 index 292893d0..00000000 --- a/lib/VoucherifySdk/models/create_publication_with_specific_voucher.rb +++ /dev/null @@ -1,266 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Create publication with specific voucher. - class CreatePublicationWithSpecificVoucher - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. - attr_accessor :source_id - - attr_accessor :customer - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # Code of voucher being published. - attr_accessor :voucher - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'source_id' => :'source_id', - :'customer' => :'customer', - :'metadata' => :'metadata', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'source_id' => :'String', - :'customer' => :'Customer', - :'metadata' => :'Object', - :'voucher' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CreatePublicationBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CreatePublicationWithSpecificVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CreatePublicationWithSpecificVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - else - self.voucher = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @voucher.nil? - invalid_properties.push('invalid value for "voucher", voucher cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer.nil? - return false if @voucher.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - source_id == o.source_id && - customer == o.customer && - metadata == o.metadata && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [source_id, customer, metadata, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/custom_event.rb b/lib/VoucherifySdk/models/custom_event.rb deleted file mode 100644 index 450f0d40..00000000 --- a/lib/VoucherifySdk/models/custom_event.rb +++ /dev/null @@ -1,351 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CustomEvent - # Unique custom event ID. - attr_accessor :id - - # The object represented is an `event`. - attr_accessor :object - - # The event name. - attr_accessor :type - - attr_accessor :customer - - attr_accessor :referral - - attr_accessor :loyalty - - # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the custom event. - attr_accessor :metadata - - # Timestamp representing the date and time when the custom event was created in ISO 8601 format. - attr_accessor :created_at - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'type' => :'type', - :'customer' => :'customer', - :'referral' => :'referral', - :'loyalty' => :'loyalty', - :'metadata' => :'metadata', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'type' => :'String', - :'customer' => :'SimpleCustomerRequiredObjectType', - :'referral' => :'CustomEventReferral', - :'loyalty' => :'Object', - :'metadata' => :'Object', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomEvent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'event' - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = nil - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'referral') - self.referral = attributes[:'referral'] - else - self.referral = nil - end - - if attributes.key?(:'loyalty') - self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @referral.nil? - invalid_properties.push('invalid value for "referral", referral cannot be nil.') - end - - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["event"]) - return false unless object_validator.valid?(@object) - return false if @type.nil? - return false if @customer.nil? - return false if @referral.nil? - return false if @loyalty.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["event"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - type == o.type && - customer == o.customer && - referral == o.referral && - loyalty == o.loyalty && - metadata == o.metadata && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, type, customer, referral, loyalty, metadata, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/custom_event_referral.rb b/lib/VoucherifySdk/models/custom_event_referral.rb deleted file mode 100644 index 92f1412f..00000000 --- a/lib/VoucherifySdk/models/custom_event_referral.rb +++ /dev/null @@ -1,236 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Referral object. - class CustomEventReferral - # Unique referrer ID. - attr_accessor :referrer_id - - # Voucher code. - attr_accessor :code - - # Unique voucher ID. - attr_accessor :id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'referrer_id' => :'referrer_id', - :'code' => :'code', - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'referrer_id' => :'String', - :'code' => :'String', - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomEventReferral` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomEventReferral`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - end - - if attributes.key?(:'code') - self.code = attributes[:'code'] - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - referrer_id == o.referrer_id && - code == o.code && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [referrer_id, code, id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/customer.rb b/lib/VoucherifySdk/models/customer.rb index 67d5adfe..8b946c86 100644 --- a/lib/VoucherifySdk/models/customer.rb +++ b/lib/VoucherifySdk/models/customer.rb @@ -15,6 +15,12 @@ module VoucherifySdk class Customer + # The ID of an existing customer. + attr_accessor :id + + # A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + attr_accessor :source_id + # Customer's first and last name. attr_accessor :name @@ -27,7 +33,7 @@ class Customer # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -38,15 +44,11 @@ class Customer # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. attr_accessor :metadata - # The ID of an existing customer. - attr_accessor :id - - # A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. - attr_accessor :source_id - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'id' => :'id', + :'source_id' => :'source_id', :'name' => :'name', :'description' => :'description', :'email' => :'email', @@ -54,9 +56,7 @@ def self.attribute_map :'birthday' => :'birthday', :'birthdate' => :'birthdate', :'address' => :'address', - :'metadata' => :'metadata', - :'id' => :'id', - :'source_id' => :'source_id' + :'metadata' => :'metadata' } end @@ -68,48 +68,51 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'id' => :'String', + :'source_id' => :'String', :'name' => :'String', :'description' => :'String', :'email' => :'String', :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', - :'metadata' => :'Object', - :'id' => :'String', - :'source_id' => :'String' + :'address' => :'CustomerAddress', + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Customer` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Customer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + if attributes.key?(:'name') self.name = attributes[:'name'] end @@ -141,14 +144,6 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -171,6 +166,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + id == o.id && + source_id == o.source_id && name == o.name && description == o.description && email == o.email && @@ -178,9 +175,7 @@ def ==(o) birthday == o.birthday && birthdate == o.birthdate && address == o.address && - metadata == o.metadata && - id == o.id && - source_id == o.source_id + metadata == o.metadata end # @see the `==` method @@ -192,7 +187,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, description, email, phone, birthday, birthdate, address, metadata, id, source_id].hash + [id, source_id, name, description, email, phone, birthday, birthdate, address, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/customer_activity.rb b/lib/VoucherifySdk/models/customer_activity.rb index 41266eb8..d878f0a2 100644 --- a/lib/VoucherifySdk/models/customer_activity.rb +++ b/lib/VoucherifySdk/models/customer_activity.rb @@ -28,27 +28,8 @@ class CustomerActivity # Timestamp representing the date and time when the customer activity occurred in ISO 8601 format. attr_accessor :created_at - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end + # Unique identifier of the request that caused the event. + attr_accessor :group_id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map @@ -56,7 +37,8 @@ def self.attribute_map :'id' => :'id', :'type' => :'type', :'data' => :'data', - :'created_at' => :'created_at' + :'created_at' => :'created_at', + :'group_id' => :'group_id' } end @@ -70,29 +52,28 @@ def self.openapi_types { :'id' => :'String', :'type' => :'String', - :'data' => :'Array', - :'created_at' => :'Time' + :'data' => :'Object', + :'created_at' => :'Time', + :'group_id' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'type', + :'data', + :'created_at', + :'group_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerActivity` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerActivity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -105,14 +86,16 @@ def initialize(attributes = {}) end if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end + self.data = attributes[:'data'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end + + if attributes.key?(:'group_id') + self.group_id = attributes[:'group_id'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -127,21 +110,9 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["customer.confirmed", "customer.created", "customer.updated", "customer.deleted", "customer.referred", "customer.custom_event", "customer.segment.entered", "customer.segment.left", "customer.sms.sent", "customer.sms.recovered", "customer.sms.failed", "customer.email.sent", "customer.email.recovered", "customer.email.failed", "customer.activecampaign.sent", "customer.activecampaign.recovered", "customer.activecampaign.failed", "customer.braze.sent", "customer.braze.recovered", "customer.braze.failed", "customer.mailchimp.sent", "customer.mailchimp.recovered", "customer.mailchimp.failed", "customer.intercom.sent", "customer.intercom.recovered", "customer.intercom.failed", "customer.shopify.sent", "customer.shopify.recovered", "customer.shopify.failed", "customer.klaviyo.sent", "customer.klaviyo.recovered", "customer.klaviyo.failed", "customer.batch.sent", "customer.batch.recovered", "customer.batch.failed", "customer.rewarded", "customer.rewarded.loyalty_points", "customer.voucher.gift.balance_added", "customer.voucher.loyalty_card.points_added", "customer.voucher.loyalty_card.points_transferred", "customer.voucher.loyalty_card.points_expired", "customer.voucher.deleted", "customer.publication.succeeded", "customer.publication.failed", "customer.validation.succeeded", "customer.validation.failed", "customer.redemption.failed", "customer.redemption.succeeded", "customer.redemption.rollback.failed", "customer.redemption.rollback.succeeded", "customer.consents.given", "customer.consents.revoked", "customer.order.canceled", "customer.order.created", "customer.order.fulfilled", "customer.order.paid", "customer.order.processing", "customer.order.updated", "customer.reward_redemptions.created", "customer.reward_redemptions.pending", "customer.reward_redemptions.completed", "customer.reward_redemptions.rolledback", "customer.loyalty.updated", "customer.loyalty.tier.upgraded", "customer.loyalty.tier.downgraded", "customer.loyalty.tier.prolonged", "customer.loyalty.tier.expiration.changed", "customer.loyalty.tier.joined", "customer.loyalty.tier.left"]) - return false unless type_validator.valid?(@type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["customer.confirmed", "customer.created", "customer.updated", "customer.deleted", "customer.referred", "customer.custom_event", "customer.segment.entered", "customer.segment.left", "customer.sms.sent", "customer.sms.recovered", "customer.sms.failed", "customer.email.sent", "customer.email.recovered", "customer.email.failed", "customer.activecampaign.sent", "customer.activecampaign.recovered", "customer.activecampaign.failed", "customer.braze.sent", "customer.braze.recovered", "customer.braze.failed", "customer.mailchimp.sent", "customer.mailchimp.recovered", "customer.mailchimp.failed", "customer.intercom.sent", "customer.intercom.recovered", "customer.intercom.failed", "customer.shopify.sent", "customer.shopify.recovered", "customer.shopify.failed", "customer.klaviyo.sent", "customer.klaviyo.recovered", "customer.klaviyo.failed", "customer.batch.sent", "customer.batch.recovered", "customer.batch.failed", "customer.rewarded", "customer.rewarded.loyalty_points", "customer.voucher.gift.balance_added", "customer.voucher.loyalty_card.points_added", "customer.voucher.loyalty_card.points_transferred", "customer.voucher.loyalty_card.points_expired", "customer.voucher.deleted", "customer.publication.succeeded", "customer.publication.failed", "customer.validation.succeeded", "customer.validation.failed", "customer.redemption.failed", "customer.redemption.succeeded", "customer.redemption.rollback.failed", "customer.redemption.rollback.succeeded", "customer.consents.given", "customer.consents.revoked", "customer.order.canceled", "customer.order.created", "customer.order.fulfilled", "customer.order.paid", "customer.order.processing", "customer.order.updated", "customer.reward_redemptions.created", "customer.reward_redemptions.pending", "customer.reward_redemptions.completed", "customer.reward_redemptions.rolledback", "customer.loyalty.updated", "customer.loyalty.tier.upgraded", "customer.loyalty.tier.downgraded", "customer.loyalty.tier.prolonged", "customer.loyalty.tier.expiration.changed", "customer.loyalty.tier.joined", "customer.loyalty.tier.left"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -150,7 +121,8 @@ def ==(o) id == o.id && type == o.type && data == o.data && - created_at == o.created_at + created_at == o.created_at && + group_id == o.group_id end # @see the `==` method @@ -162,7 +134,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, type, data, created_at].hash + [id, type, data, created_at, group_id].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/customer_activity_data.rb b/lib/VoucherifySdk/models/customer_activity_data.rb deleted file mode 100644 index b7e88317..00000000 --- a/lib/VoucherifySdk/models/customer_activity_data.rb +++ /dev/null @@ -1,173 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema. - module CustomerActivityData - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'EventCustomerActiveCampaignFailed', - :'EventCustomerActiveCampaignRecovered', - :'EventCustomerActiveCampaignSent', - :'EventCustomerBatchFailed', - :'EventCustomerBatchRecovered', - :'EventCustomerBatchSent', - :'EventCustomerBrazeFailed', - :'EventCustomerBrazeRecovered', - :'EventCustomerBrazeSent', - :'EventCustomerConfirmed', - :'EventCustomerConsentsGiven', - :'EventCustomerConsentsRevoked', - :'EventCustomerCreated', - :'EventCustomerCustomEvent', - :'EventCustomerDeleted', - :'EventCustomerEmailFailed', - :'EventCustomerEmailRecovered', - :'EventCustomerEmailSent', - :'EventCustomerGiftVoucherBalanceAdded', - :'EventCustomerIntercomFailed', - :'EventCustomerIntercomRecovered', - :'EventCustomerIntercomSent', - :'EventCustomerKlaviyoFailed', - :'EventCustomerKlaviyoRecovered', - :'EventCustomerKlaviyoSent', - :'EventCustomerLoyaltyCardPointsAdded', - :'EventCustomerLoyaltyCardPointsTransferred', - :'EventCustomerLoyaltyTierDowngraded', - :'EventCustomerLoyaltyTierExpirationChanged', - :'EventCustomerLoyaltyTierJoined', - :'EventCustomerLoyaltyTierLeft', - :'EventCustomerLoyaltyTierProlonged', - :'EventCustomerLoyaltyTierUpgraded', - :'EventCustomerLoyaltyUpdated', - :'EventCustomerMailchimpFailed', - :'EventCustomerMailchimpRecovered', - :'EventCustomerMailchimpSent', - :'EventCustomerOrderCanceled', - :'EventCustomerOrderCreated', - :'EventCustomerOrderFulfilled', - :'EventCustomerOrderPaid', - :'EventCustomerOrderProcessing', - :'EventCustomerOrderUpdated', - :'EventCustomerPublicationFailed', - :'EventCustomerPublicationSucceeded', - :'EventCustomerRedemptionFailed', - :'EventCustomerRedemptionRollbackFailed', - :'EventCustomerRedemptionRollbackSucceeded', - :'EventCustomerRedemptionSucceeded', - :'EventCustomerReferred', - :'EventCustomerRewardRedemptionsCompleted', - :'EventCustomerRewardRedemptionsCreated', - :'EventCustomerRewardRedemptionsPending', - :'EventCustomerRewardRedemptionsRolledBack', - :'EventCustomerRewarded', - :'EventCustomerRewardedLoyaltyPoints', - :'EventCustomerSegmentEntered', - :'EventCustomerSegmentLeft', - :'EventCustomerShopifyFailed', - :'EventCustomerShopifyRecovered', - :'EventCustomerShopifySent', - :'EventCustomerSmsFailed', - :'EventCustomerSmsRecovered', - :'EventCustomerSmsSent', - :'EventCustomerUpdated', - :'EventCustomerValidationFailed', - :'EventCustomerValidationSucceeded', - :'EventCustomerVoucherDeleted', - :'EventCustomerVouchersLoyaltyPointsExpired' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/customer_address.rb b/lib/VoucherifySdk/models/customer_address.rb new file mode 100644 index 00000000..83737ce1 --- /dev/null +++ b/lib/VoucherifySdk/models/customer_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomerAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customer_base.rb b/lib/VoucherifySdk/models/customer_base.rb deleted file mode 100644 index 2f720142..00000000 --- a/lib/VoucherifySdk/models/customer_base.rb +++ /dev/null @@ -1,285 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class CustomerBase - # Customer's first and last name. - attr_accessor :name - - # An arbitrary string that you can attach to a customer object. - attr_accessor :description - - # Customer's email address. - attr_accessor :email - - # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. - attr_accessor :phone - - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. - attr_accessor :birthday - - # Customer's birthdate; format YYYY-MM-DD. - attr_accessor :birthdate - - attr_accessor :address - - # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. - attr_accessor :metadata - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'description' => :'description', - :'email' => :'email', - :'phone' => :'phone', - :'birthday' => :'birthday', - :'birthdate' => :'birthdate', - :'address' => :'address', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'description' => :'String', - :'email' => :'String', - :'phone' => :'String', - :'birthday' => :'Date', - :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'address', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'email') - self.email = attributes[:'email'] - end - - if attributes.key?(:'phone') - self.phone = attributes[:'phone'] - end - - if attributes.key?(:'birthday') - self.birthday = attributes[:'birthday'] - end - - if attributes.key?(:'birthdate') - self.birthdate = attributes[:'birthdate'] - end - - if attributes.key?(:'address') - self.address = attributes[:'address'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - description == o.description && - email == o.email && - phone == o.phone && - birthday == o.birthday && - birthdate == o.birthdate && - address == o.address && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, description, email, phone, birthday, birthdate, address, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/customer_base_address.rb b/lib/VoucherifySdk/models/customer_base_address.rb deleted file mode 100644 index 8b49cdd2..00000000 --- a/lib/VoucherifySdk/models/customer_base_address.rb +++ /dev/null @@ -1,266 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Customer's address. - class CustomerBaseAddress - # City - attr_accessor :city - - # State - attr_accessor :state - - # First line of address. - attr_accessor :line_1 - - # Second line of address. - attr_accessor :line_2 - - # Country. - attr_accessor :country - - # Postal code. - attr_accessor :postal_code - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'city' => :'city', - :'state' => :'state', - :'line_1' => :'line_1', - :'line_2' => :'line_2', - :'country' => :'country', - :'postal_code' => :'postal_code' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'city' => :'String', - :'state' => :'String', - :'line_1' => :'String', - :'line_2' => :'String', - :'country' => :'String', - :'postal_code' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerBaseAddress` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerBaseAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'city') - self.city = attributes[:'city'] - end - - if attributes.key?(:'state') - self.state = attributes[:'state'] - end - - if attributes.key?(:'line_1') - self.line_1 = attributes[:'line_1'] - end - - if attributes.key?(:'line_2') - self.line_2 = attributes[:'line_2'] - end - - if attributes.key?(:'country') - self.country = attributes[:'country'] - end - - if attributes.key?(:'postal_code') - self.postal_code = attributes[:'postal_code'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - city == o.city && - state == o.state && - line_1 == o.line_1 && - line_2 == o.line_2 && - country == o.country && - postal_code == o.postal_code - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [city, state, line_1, line_2, country, postal_code].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/customer_id.rb b/lib/VoucherifySdk/models/customer_id.rb index 83a18fc9..44af0e37 100644 --- a/lib/VoucherifySdk/models/customer_id.rb +++ b/lib/VoucherifySdk/models/customer_id.rb @@ -18,7 +18,7 @@ class CustomerId # A unique identifier of an existing customer. attr_accessor :id - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object class EnumAttributeValidator @@ -67,28 +67,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -103,14 +96,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -118,23 +103,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["customer"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/customer_loyalty.rb b/lib/VoucherifySdk/models/customer_loyalty.rb index 875cae62..56638e14 100644 --- a/lib/VoucherifySdk/models/customer_loyalty.rb +++ b/lib/VoucherifySdk/models/customer_loyalty.rb @@ -43,49 +43,39 @@ def self.openapi_types { :'points' => :'Integer', :'referred_customers' => :'Integer', - :'campaigns' => :'Hash' + :'campaigns' => :'Hash' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'referred_customers', + :'campaigns' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerLoyalty` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerLoyalty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'referred_customers') self.referred_customers = attributes[:'referred_customers'] - else - self.referred_customers = nil end if attributes.key?(:'campaigns') if (value = attributes[:'campaigns']).is_a?(Hash) self.campaigns = value end - else - self.campaigns = nil end end @@ -94,18 +84,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @referred_customers.nil? - invalid_properties.push('invalid value for "referred_customers", referred_customers cannot be nil.') - end - - if @campaigns.nil? - invalid_properties.push('invalid value for "campaigns", campaigns cannot be nil.') - end - invalid_properties end @@ -113,9 +91,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? - return false if @referred_customers.nil? - return false if @campaigns.nil? true end diff --git a/lib/VoucherifySdk/models/customer_loyalty_campaigns_entry.rb b/lib/VoucherifySdk/models/customer_loyalty_campaigns_entry.rb new file mode 100644 index 00000000..a0cb2e03 --- /dev/null +++ b/lib/VoucherifySdk/models/customer_loyalty_campaigns_entry.rb @@ -0,0 +1,229 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign. + class CustomerLoyaltyCampaignsEntry + # Remaining point balance in campaign. + attr_accessor :points + + # Customer's loyalty tier within the campaign. + attr_accessor :loyalty_tier + + # Number of customers referred by the customer in campaign. + attr_accessor :referred_customers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'loyalty_tier' => :'loyalty_tier', + :'referred_customers' => :'referred_customers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'loyalty_tier' => :'String', + :'referred_customers' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + + if attributes.key?(:'referred_customers') + self.referred_customers = attributes[:'referred_customers'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + loyalty_tier == o.loyalty_tier && + referred_customers == o.referred_customers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, loyalty_tier, referred_customers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customer_loyalty_campaigns_value.rb b/lib/VoucherifySdk/models/customer_loyalty_campaigns_value.rb deleted file mode 100644 index dfd70318..00000000 --- a/lib/VoucherifySdk/models/customer_loyalty_campaigns_value.rb +++ /dev/null @@ -1,236 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign. - class CustomerLoyaltyCampaignsValue - # Remaining point balance in campaign. - attr_accessor :points - - # Customer's loyalty tier within the campaign. - attr_accessor :loyalty_tier - - # Number of customers referred by the customer in campaign. - attr_accessor :referred_customers - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'points' => :'points', - :'loyalty_tier' => :'loyalty_tier', - :'referred_customers' => :'referred_customers' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'points' => :'Integer', - :'loyalty_tier' => :'String', - :'referred_customers' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerLoyaltyCampaignsValue` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerLoyaltyCampaignsValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - - if attributes.key?(:'loyalty_tier') - self.loyalty_tier = attributes[:'loyalty_tier'] - end - - if attributes.key?(:'referred_customers') - self.referred_customers = attributes[:'referred_customers'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - points == o.points && - loyalty_tier == o.loyalty_tier && - referred_customers == o.referred_customers - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [points, loyalty_tier, referred_customers].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/customer_redeemable.rb b/lib/VoucherifySdk/models/customer_redeemable.rb new file mode 100644 index 00000000..f571ceb6 --- /dev/null +++ b/lib/VoucherifySdk/models/customer_redeemable.rb @@ -0,0 +1,342 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Single customer's redeemable + class CustomerRedeemable + # Unique redeemable holder identifier. + attr_accessor :id + + # Timestamp representing the date and time when the redeemable was assigned. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Identifier of the redeemable item. + attr_accessor :redeemable_id + + # Type of the redeemable. + attr_accessor :redeemable_object + + # Identifier of the customer. + attr_accessor :customer_id + + # Role of the holder. + attr_accessor :holder_role + + # Unique campaign identifier, assigned by Voucherify. + attr_accessor :campaign_id + + # Defines the type of the campaign. + attr_accessor :campaign_type + + # Defines the type of the voucher. + attr_accessor :voucher_type + + attr_accessor :redeemable + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'redeemable_id' => :'redeemable_id', + :'redeemable_object' => :'redeemable_object', + :'customer_id' => :'customer_id', + :'holder_role' => :'holder_role', + :'campaign_id' => :'campaign_id', + :'campaign_type' => :'campaign_type', + :'voucher_type' => :'voucher_type', + :'redeemable' => :'redeemable' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'redeemable_id' => :'String', + :'redeemable_object' => :'String', + :'customer_id' => :'String', + :'holder_role' => :'String', + :'campaign_id' => :'String', + :'campaign_type' => :'String', + :'voucher_type' => :'String', + :'redeemable' => :'CustomerRedeemableRedeemable' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'redeemable_id', + :'redeemable_object', + :'customer_id', + :'holder_role', + :'campaign_id', + :'campaign_type', + :'voucher_type', + :'redeemable' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'redeemable_id') + self.redeemable_id = attributes[:'redeemable_id'] + end + + if attributes.key?(:'redeemable_object') + self.redeemable_object = attributes[:'redeemable_object'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'holder_role') + self.holder_role = attributes[:'holder_role'] + else + self.holder_role = 'OWNER' + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + else + self.campaign_type = 'DISCOUNT_COUPONS' + end + + if attributes.key?(:'voucher_type') + self.voucher_type = attributes[:'voucher_type'] + else + self.voucher_type = 'DISCOUNT_VOUCHER' + end + + if attributes.key?(:'redeemable') + self.redeemable = attributes[:'redeemable'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + holder_role_validator = EnumAttributeValidator.new('String', ["OWNER", "REFERRER", "REFEREE"]) + return false unless holder_role_validator.valid?(@holder_role) + campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "PROMOTION", "REFERRAL_PROGRAM", "LUCKY_DRAW"]) + return false unless campaign_type_validator.valid?(@campaign_type) + voucher_type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD", "LUCKY_DRAW_CODE"]) + return false unless voucher_type_validator.valid?(@voucher_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + redeemable_id == o.redeemable_id && + redeemable_object == o.redeemable_object && + customer_id == o.customer_id && + holder_role == o.holder_role && + campaign_id == o.campaign_id && + campaign_type == o.campaign_type && + voucher_type == o.voucher_type && + redeemable == o.redeemable + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, redeemable_id, redeemable_object, customer_id, holder_role, campaign_id, campaign_type, voucher_type, redeemable].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customer_redeemable_redeemable.rb b/lib/VoucherifySdk/models/customer_redeemable_redeemable.rb new file mode 100644 index 00000000..e0c900a8 --- /dev/null +++ b/lib/VoucherifySdk/models/customer_redeemable_redeemable.rb @@ -0,0 +1,263 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Detailed information about the customer's redeemable item + class CustomerRedeemableRedeemable + # Type of the redeemable. + attr_accessor :type + + attr_accessor :voucher + + # Status of the redeemable. + attr_accessor :status + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'voucher' => :'voucher', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'voucher' => :'RedeemableVoucher', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'status' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + else + self.voucher = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 'ACTIVE' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @voucher.nil? + invalid_properties.push('invalid value for "voucher", voucher cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @voucher.nil? + status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "USED", "DISABLED", "NOT_ACTIVE_YET", "EXPIRED", "NO_BALANCE"]) + return false unless status_validator.valid?(@status) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + voucher == o.voucher && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, voucher, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customer_referrals.rb b/lib/VoucherifySdk/models/customer_referrals.rb index 01865f6a..5fd590a8 100644 --- a/lib/VoucherifySdk/models/customer_referrals.rb +++ b/lib/VoucherifySdk/models/customer_referrals.rb @@ -46,36 +46,27 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'total', + :'campaigns' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerReferrals` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerReferrals`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'campaigns') if (value = attributes[:'campaigns']).is_a?(Array) self.campaigns = value end - else - self.campaigns = nil end end @@ -84,14 +75,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @campaigns.nil? - invalid_properties.push('invalid value for "campaigns", campaigns cannot be nil.') - end - invalid_properties end @@ -99,8 +82,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @total.nil? - return false if @campaigns.nil? true end diff --git a/lib/VoucherifySdk/models/customer_referrals_campaigns_item.rb b/lib/VoucherifySdk/models/customer_referrals_campaigns_item.rb index 80602368..a6f60c35 100644 --- a/lib/VoucherifySdk/models/customer_referrals_campaigns_item.rb +++ b/lib/VoucherifySdk/models/customer_referrals_campaigns_item.rb @@ -67,15 +67,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerReferralsCampaignsItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerReferralsCampaignsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/customer_response_data_assets.rb b/lib/VoucherifySdk/models/customer_response_data_assets.rb deleted file mode 100644 index 6d1f3774..00000000 --- a/lib/VoucherifySdk/models/customer_response_data_assets.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains information about the customer's cockpit. - class CustomerResponseDataAssets - # Customer's cockpit URL address. - attr_accessor :cockpit_url - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'cockpit_url' => :'cockpit_url' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'cockpit_url' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerResponseDataAssets` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerResponseDataAssets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'cockpit_url') - self.cockpit_url = attributes[:'cockpit_url'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - cockpit_url == o.cockpit_url - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [cockpit_url].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/customer_segments_list.rb b/lib/VoucherifySdk/models/customer_segments_list.rb deleted file mode 100644 index 110559bd..00000000 --- a/lib/VoucherifySdk/models/customer_segments_list.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # List of customer's segments - class CustomerSegmentsList - # The type of object represented by JSON. This object stores information about customer segments. - attr_accessor :object - - # Identifies the name of the JSON property that contains the array of segment IDs. - attr_accessor :data_ref - - # A dictionary that contains an array of segment IDs and names. - attr_accessor :data - - # Total number of segments the customer belongs to. - attr_accessor :total - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'data_ref' => :'data_ref', - :'data' => :'data', - :'total' => :'total' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'data_ref' => :'String', - :'data' => :'Array', - :'total' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerSegmentsList` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerSegmentsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'list' - end - - if attributes.key?(:'data_ref') - self.data_ref = attributes[:'data_ref'] - else - self.data_ref = 'data' - end - - if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end - else - self.data = nil - end - - if attributes.key?(:'total') - self.total = attributes[:'total'] - else - self.total = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - data_ref == o.data_ref && - data == o.data && - total == o.total - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, data_ref, data, total].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/customer_summary.rb b/lib/VoucherifySdk/models/customer_summary.rb index d7854709..5aa43b58 100644 --- a/lib/VoucherifySdk/models/customer_summary.rb +++ b/lib/VoucherifySdk/models/customer_summary.rb @@ -49,15 +49,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerSummary` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/customer_summary_orders.rb b/lib/VoucherifySdk/models/customer_summary_orders.rb index 977f8daa..ace802b4 100644 --- a/lib/VoucherifySdk/models/customer_summary_orders.rb +++ b/lib/VoucherifySdk/models/customer_summary_orders.rb @@ -60,46 +60,36 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'total_amount', + :'total_count', + :'average_amount', + :'last_order_amount', + :'last_order_date' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerSummaryOrders` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerSummaryOrders`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'total_amount') self.total_amount = attributes[:'total_amount'] - else - self.total_amount = nil end if attributes.key?(:'total_count') self.total_count = attributes[:'total_count'] - else - self.total_count = nil end if attributes.key?(:'average_amount') self.average_amount = attributes[:'average_amount'] - else - self.average_amount = nil end if attributes.key?(:'last_order_amount') self.last_order_amount = attributes[:'last_order_amount'] - else - self.last_order_amount = nil end if attributes.key?(:'last_order_date') @@ -112,22 +102,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @total_amount.nil? - invalid_properties.push('invalid value for "total_amount", total_amount cannot be nil.') - end - - if @total_count.nil? - invalid_properties.push('invalid value for "total_count", total_count cannot be nil.') - end - - if @average_amount.nil? - invalid_properties.push('invalid value for "average_amount", average_amount cannot be nil.') - end - - if @last_order_amount.nil? - invalid_properties.push('invalid value for "last_order_amount", last_order_amount cannot be nil.') - end - invalid_properties end @@ -135,10 +109,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @total_amount.nil? - return false if @total_count.nil? - return false if @average_amount.nil? - return false if @last_order_amount.nil? true end diff --git a/lib/VoucherifySdk/models/customer_summary_redemptions.rb b/lib/VoucherifySdk/models/customer_summary_redemptions.rb index af756195..a84b74d7 100644 --- a/lib/VoucherifySdk/models/customer_summary_redemptions.rb +++ b/lib/VoucherifySdk/models/customer_summary_redemptions.rb @@ -73,70 +73,55 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'total_redeemed', + :'total_failed', + :'total_succeeded', + :'total_rolled_back', + :'total_rollback_failed', + :'total_rollback_succeeded', + :'gift', + :'loyalty_card' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerSummaryRedemptions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerSummaryRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'total_redeemed') self.total_redeemed = attributes[:'total_redeemed'] - else - self.total_redeemed = nil end if attributes.key?(:'total_failed') self.total_failed = attributes[:'total_failed'] - else - self.total_failed = nil end if attributes.key?(:'total_succeeded') self.total_succeeded = attributes[:'total_succeeded'] - else - self.total_succeeded = nil end if attributes.key?(:'total_rolled_back') self.total_rolled_back = attributes[:'total_rolled_back'] - else - self.total_rolled_back = nil end if attributes.key?(:'total_rollback_failed') self.total_rollback_failed = attributes[:'total_rollback_failed'] - else - self.total_rollback_failed = nil end if attributes.key?(:'total_rollback_succeeded') self.total_rollback_succeeded = attributes[:'total_rollback_succeeded'] - else - self.total_rollback_succeeded = nil end if attributes.key?(:'gift') self.gift = attributes[:'gift'] - else - self.gift = nil end if attributes.key?(:'loyalty_card') self.loyalty_card = attributes[:'loyalty_card'] - else - self.loyalty_card = nil end end @@ -145,38 +130,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @total_redeemed.nil? - invalid_properties.push('invalid value for "total_redeemed", total_redeemed cannot be nil.') - end - - if @total_failed.nil? - invalid_properties.push('invalid value for "total_failed", total_failed cannot be nil.') - end - - if @total_succeeded.nil? - invalid_properties.push('invalid value for "total_succeeded", total_succeeded cannot be nil.') - end - - if @total_rolled_back.nil? - invalid_properties.push('invalid value for "total_rolled_back", total_rolled_back cannot be nil.') - end - - if @total_rollback_failed.nil? - invalid_properties.push('invalid value for "total_rollback_failed", total_rollback_failed cannot be nil.') - end - - if @total_rollback_succeeded.nil? - invalid_properties.push('invalid value for "total_rollback_succeeded", total_rollback_succeeded cannot be nil.') - end - - if @gift.nil? - invalid_properties.push('invalid value for "gift", gift cannot be nil.') - end - - if @loyalty_card.nil? - invalid_properties.push('invalid value for "loyalty_card", loyalty_card cannot be nil.') - end - invalid_properties end @@ -184,14 +137,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @total_redeemed.nil? - return false if @total_failed.nil? - return false if @total_succeeded.nil? - return false if @total_rolled_back.nil? - return false if @total_rollback_failed.nil? - return false if @total_rollback_succeeded.nil? - return false if @gift.nil? - return false if @loyalty_card.nil? true end diff --git a/lib/VoucherifySdk/models/customer_summary_redemptions_gift.rb b/lib/VoucherifySdk/models/customer_summary_redemptions_gift.rb index 22dc0fb0..004e13e1 100644 --- a/lib/VoucherifySdk/models/customer_summary_redemptions_gift.rb +++ b/lib/VoucherifySdk/models/customer_summary_redemptions_gift.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'redeemed_amount', + :'amount_to_go' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerSummaryRedemptionsGift` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerSummaryRedemptionsGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -82,14 +77,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemed_amount.nil? - invalid_properties.push('invalid value for "redeemed_amount", redeemed_amount cannot be nil.') - end - - if @amount_to_go.nil? - invalid_properties.push('invalid value for "amount_to_go", amount_to_go cannot be nil.') - end - invalid_properties end @@ -97,8 +84,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemed_amount.nil? - return false if @amount_to_go.nil? true end diff --git a/lib/VoucherifySdk/models/customer_summary_redemptions_loyalty_card.rb b/lib/VoucherifySdk/models/customer_summary_redemptions_loyalty_card.rb index 3721e599..10c9b413 100644 --- a/lib/VoucherifySdk/models/customer_summary_redemptions_loyalty_card.rb +++ b/lib/VoucherifySdk/models/customer_summary_redemptions_loyalty_card.rb @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'redeemed_points', + :'points_to_go' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerSummaryRedemptionsLoyaltyCard` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerSummaryRedemptionsLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'redeemed_points') self.redeemed_points = attributes[:'redeemed_points'] - else - self.redeemed_points = nil end if attributes.key?(:'points_to_go') self.points_to_go = attributes[:'points_to_go'] - else - self.points_to_go = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemed_points.nil? - invalid_properties.push('invalid value for "redeemed_points", redeemed_points cannot be nil.') - end - - if @points_to_go.nil? - invalid_properties.push('invalid value for "points_to_go", points_to_go cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemed_points.nil? - return false if @points_to_go.nil? true end diff --git a/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals.rb b/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals.rb index e109c046..a3663870 100644 --- a/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals.rb +++ b/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals.rb @@ -15,29 +15,6 @@ module VoucherifySdk class CustomerWithSummaryLoyaltyReferrals - # Customer's first and last name. - attr_accessor :name - - # An arbitrary string that you can attach to a customer object. - attr_accessor :description - - # Customer's email address. - attr_accessor :email - - # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. - attr_accessor :phone - - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. - attr_accessor :birthday - - # Customer's birthdate; format YYYY-MM-DD. - attr_accessor :birthdate - - attr_accessor :address - - # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. - attr_accessor :metadata - # The ID of an existing customer that will be linked to redemption in this request. attr_accessor :id @@ -53,17 +30,40 @@ class CustomerWithSummaryLoyaltyReferrals # Object used to store system metadata information. attr_accessor :system_metadata - # Timestamp representing the date and time when the customer was created in ISO 8601 format. + # Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the customer was updated in ISO 8601 format. + # Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at attr_accessor :assets - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object + # Customer's first and last name. + attr_accessor :name + + # An arbitrary string that you can attach to a customer object. + attr_accessor :description + + # Customer's email address. + attr_accessor :email + + # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + attr_accessor :phone + + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + attr_accessor :birthday + + # Customer's birthdate; format YYYY-MM-DD. + attr_accessor :birthdate + + attr_accessor :address + + # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + attr_accessor :metadata + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -89,14 +89,6 @@ def valid?(value) # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'name' => :'name', - :'description' => :'description', - :'email' => :'email', - :'phone' => :'phone', - :'birthday' => :'birthday', - :'birthdate' => :'birthdate', - :'address' => :'address', - :'metadata' => :'metadata', :'id' => :'id', :'source_id' => :'source_id', :'summary' => :'summary', @@ -106,7 +98,15 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'assets' => :'assets', - :'object' => :'object' + :'object' => :'object', + :'name' => :'name', + :'description' => :'description', + :'email' => :'email', + :'phone' => :'phone', + :'birthday' => :'birthday', + :'birthdate' => :'birthdate', + :'address' => :'address', + :'metadata' => :'metadata' } end @@ -118,14 +118,6 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'name' => :'String', - :'description' => :'String', - :'email' => :'String', - :'phone' => :'String', - :'birthday' => :'Date', - :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', - :'metadata' => :'Object', :'id' => :'String', :'source_id' => :'String', :'summary' => :'CustomerSummary', @@ -134,75 +126,48 @@ def self.openapi_types :'system_metadata' => :'Object', :'created_at' => :'Time', :'updated_at' => :'Time', - :'assets' => :'CustomerResponseDataAssets', - :'object' => :'String' + :'assets' => :'CustomerWithSummaryLoyaltyReferralsAssets', + :'object' => :'String', + :'name' => :'String', + :'description' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'birthday' => :'Date', + :'birthdate' => :'Date', + :'address' => :'CustomerWithSummaryLoyaltyReferralsAddress', + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'system_metadata', + :'created_at', + :'updated_at', + :'assets', + :'object', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', - :'summary', - :'loyalty', - :'referrals', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomerWithSummaryLoyaltyReferrals` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomerWithSummaryLoyaltyReferrals`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'email') - self.email = attributes[:'email'] - end - - if attributes.key?(:'phone') - self.phone = attributes[:'phone'] - end - - if attributes.key?(:'birthday') - self.birthday = attributes[:'birthday'] - end - - if attributes.key?(:'birthdate') - self.birthdate = attributes[:'birthdate'] - end - - if attributes.key?(:'address') - self.address = attributes[:'address'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - if attributes.key?(:'id') self.id = attributes[:'id'] end @@ -213,20 +178,14 @@ def initialize(attributes = {}) if attributes.key?(:'summary') self.summary = attributes[:'summary'] - else - self.summary = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'referrals') self.referrals = attributes[:'referrals'] - else - self.referrals = nil end if attributes.key?(:'system_metadata') @@ -250,6 +209,38 @@ def initialize(attributes = {}) else self.object = 'customer' end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'birthday') + self.birthday = attributes[:'birthday'] + end + + if attributes.key?(:'birthdate') + self.birthdate = attributes[:'birthdate'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -257,10 +248,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -268,35 +255,16 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["customer"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && - name == o.name && - description == o.description && - email == o.email && - phone == o.phone && - birthday == o.birthday && - birthdate == o.birthdate && - address == o.address && - metadata == o.metadata && id == o.id && source_id == o.source_id && summary == o.summary && @@ -306,7 +274,15 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && assets == o.assets && - object == o.object + object == o.object && + name == o.name && + description == o.description && + email == o.email && + phone == o.phone && + birthday == o.birthday && + birthdate == o.birthdate && + address == o.address && + metadata == o.metadata end # @see the `==` method @@ -318,7 +294,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, description, email, phone, birthday, birthdate, address, metadata, id, source_id, summary, loyalty, referrals, system_metadata, created_at, updated_at, assets, object].hash + [id, source_id, summary, loyalty, referrals, system_metadata, created_at, updated_at, assets, object, name, description, email, phone, birthday, birthdate, address, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals_address.rb b/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals_address.rb new file mode 100644 index 00000000..fff1ad00 --- /dev/null +++ b/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomerWithSummaryLoyaltyReferralsAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals_assets.rb b/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals_assets.rb new file mode 100644 index 00000000..98da47af --- /dev/null +++ b/lib/VoucherifySdk/models/customer_with_summary_loyalty_referrals_assets.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the customer's cockpit. + class CustomerWithSummaryLoyaltyReferralsAssets + # Customer's cockpit URL address. + attr_accessor :cockpit_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cockpit_url' => :'cockpit_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'cockpit_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'cockpit_url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'cockpit_url') + self.cockpit_url = attributes[:'cockpit_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cockpit_url == o.cockpit_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cockpit_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_activities_list_response_body.rb b/lib/VoucherifySdk/models/customers_activities_list_response_body.rb index 7ac3d90f..a600eb2a 100644 --- a/lib/VoucherifySdk/models/customers_activities_list_response_body.rb +++ b/lib/VoucherifySdk/models/customers_activities_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Request body schema for **GET** `/customers/{customerId}/activities`. + # Response body schema for **GET** `v1/customers/{customerId}/activities`. class CustomersActivitiesListResponseBody - # The type of object represented by JSON. This object stores information about customer activities in a dictionary. + # The type of the object represented by JSON. This object stores information about customer activities in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of customer activity objects. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersActivitiesListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersActivitiesListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/customers_activity_list_response_body.rb b/lib/VoucherifySdk/models/customers_activity_list_response_body.rb new file mode 100644 index 00000000..f31ad26a --- /dev/null +++ b/lib/VoucherifySdk/models/customers_activity_list_response_body.rb @@ -0,0 +1,284 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/customers/{customerId}/activity`. + class CustomersActivityListResponseBody + # The type of the object represented by JSON. This object stores information about customer activities in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of customer activity objects. + attr_accessor :data_ref + + # Array of customer activity objects. + attr_accessor :data + + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. + attr_accessor :has_more + + # Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. + attr_accessor :more_starting_after + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'has_more' => :'has_more', + :'more_starting_after' => :'more_starting_after' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'has_more' => :'Boolean', + :'more_starting_after' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'has_more', + :'more_starting_after' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'more_starting_after') + self.more_starting_after = attributes[:'more_starting_after'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + has_more == o.has_more && + more_starting_after == o.more_starting_after + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, has_more, more_starting_after].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_create_request_body.rb b/lib/VoucherifySdk/models/customers_create_request_body.rb index e1db62b7..9abcfa76 100644 --- a/lib/VoucherifySdk/models/customers_create_request_body.rb +++ b/lib/VoucherifySdk/models/customers_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/customers`. + # Request body schema for **POST** `v1/customers`. class CustomersCreateRequestBody # The ID of an existing customer. attr_accessor :id @@ -34,7 +34,7 @@ class CustomersCreateRequestBody # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -77,7 +77,7 @@ def self.openapi_types :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', + :'address' => :'CustomersCreateRequestBodyAddress', :'metadata' => :'Object' } end @@ -85,29 +85,24 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Customer' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/customers_create_request_body_address.rb b/lib/VoucherifySdk/models/customers_create_request_body_address.rb new file mode 100644 index 00000000..044e91e6 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_create_request_body_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomersCreateRequestBodyAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_create_response_body.rb b/lib/VoucherifySdk/models/customers_create_response_body.rb index 2c788c2a..a6590152 100644 --- a/lib/VoucherifySdk/models/customers_create_response_body.rb +++ b/lib/VoucherifySdk/models/customers_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response bofy for **POST** `/customers`. + # Response body for **POST** `v1/customers`. class CustomersCreateResponseBody # The ID of an existing customer that will be linked to redemption in this request. attr_accessor :id @@ -31,15 +31,15 @@ class CustomersCreateResponseBody # Object used to store system metadata information. attr_accessor :system_metadata - # Timestamp representing the date and time when the customer was created in ISO 8601 format. + # Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the customer was updated in ISO 8601 format. + # Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at attr_accessor :assets - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Customer's first and last name. @@ -54,7 +54,7 @@ class CustomersCreateResponseBody # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -127,7 +127,7 @@ def self.openapi_types :'system_metadata' => :'Object', :'created_at' => :'Time', :'updated_at' => :'Time', - :'assets' => :'CustomerResponseDataAssets', + :'assets' => :'CustomersCreateResponseBodyAssets', :'object' => :'String', :'name' => :'String', :'description' => :'String', @@ -135,7 +135,7 @@ def self.openapi_types :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', + :'address' => :'CustomersCreateResponseBodyAddress', :'metadata' => :'Object' } end @@ -143,32 +143,29 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'summary', - :'loyalty', - :'referrals', + :'id', + :'source_id', + :'system_metadata', + :'created_at', + :'updated_at', + :'assets', + :'object', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerWithSummaryLoyaltyReferrals' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -182,20 +179,14 @@ def initialize(attributes = {}) if attributes.key?(:'summary') self.summary = attributes[:'summary'] - else - self.summary = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'referrals') self.referrals = attributes[:'referrals'] - else - self.referrals = nil end if attributes.key?(:'system_metadata') @@ -258,10 +249,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -269,22 +256,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["customer"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/customers_create_response_body_address.rb b/lib/VoucherifySdk/models/customers_create_response_body_address.rb new file mode 100644 index 00000000..e7f13c24 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_create_response_body_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomersCreateResponseBodyAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_create_response_body_assets.rb b/lib/VoucherifySdk/models/customers_create_response_body_assets.rb new file mode 100644 index 00000000..3f1fbee2 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_create_response_body_assets.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the customer's cockpit. + class CustomersCreateResponseBodyAssets + # Customer's cockpit URL address. + attr_accessor :cockpit_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cockpit_url' => :'cockpit_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'cockpit_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'cockpit_url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'cockpit_url') + self.cockpit_url = attributes[:'cockpit_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cockpit_url == o.cockpit_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cockpit_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_get_response_body.rb b/lib/VoucherifySdk/models/customers_get_response_body.rb index d31106de..86c6cf71 100644 --- a/lib/VoucherifySdk/models/customers_get_response_body.rb +++ b/lib/VoucherifySdk/models/customers_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/customers/{customerId}`. + # Response body schema for **GET** `v1/customers/{customerId}`. class CustomersGetResponseBody # The ID of an existing customer that will be linked to redemption in this request. attr_accessor :id @@ -31,15 +31,15 @@ class CustomersGetResponseBody # Object used to store system metadata information. attr_accessor :system_metadata - # Timestamp representing the date and time when the customer was created in ISO 8601 format. + # Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the customer was updated in ISO 8601 format. + # Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at attr_accessor :assets - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Customer's first and last name. @@ -54,7 +54,7 @@ class CustomersGetResponseBody # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -127,7 +127,7 @@ def self.openapi_types :'system_metadata' => :'Object', :'created_at' => :'Time', :'updated_at' => :'Time', - :'assets' => :'CustomerResponseDataAssets', + :'assets' => :'CustomersGetResponseBodyAssets', :'object' => :'String', :'name' => :'String', :'description' => :'String', @@ -135,7 +135,7 @@ def self.openapi_types :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', + :'address' => :'CustomersGetResponseBodyAddress', :'metadata' => :'Object' } end @@ -143,32 +143,29 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'summary', - :'loyalty', - :'referrals', + :'id', + :'source_id', + :'system_metadata', + :'created_at', + :'updated_at', + :'assets', + :'object', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerWithSummaryLoyaltyReferrals' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -182,20 +179,14 @@ def initialize(attributes = {}) if attributes.key?(:'summary') self.summary = attributes[:'summary'] - else - self.summary = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'referrals') self.referrals = attributes[:'referrals'] - else - self.referrals = nil end if attributes.key?(:'system_metadata') @@ -258,10 +249,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -269,22 +256,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["customer"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/customers_get_response_body_address.rb b/lib/VoucherifySdk/models/customers_get_response_body_address.rb new file mode 100644 index 00000000..4e7694d3 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_get_response_body_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomersGetResponseBodyAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_get_response_body_assets.rb b/lib/VoucherifySdk/models/customers_get_response_body_assets.rb new file mode 100644 index 00000000..44560c19 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_get_response_body_assets.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the customer's cockpit. + class CustomersGetResponseBodyAssets + # Customer's cockpit URL address. + attr_accessor :cockpit_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cockpit_url' => :'cockpit_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'cockpit_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'cockpit_url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'cockpit_url') + self.cockpit_url = attributes[:'cockpit_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cockpit_url == o.cockpit_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cockpit_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_import_csv_create_response_body.rb b/lib/VoucherifySdk/models/customers_import_csv_create_response_body.rb index b3944e4a..1c270ced 100644 --- a/lib/VoucherifySdk/models/customers_import_csv_create_response_body.rb +++ b/lib/VoucherifySdk/models/customers_import_csv_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/customers/importCSV`. + # Response body schema for **POST** `v1/customers/importCSV`. class CustomersImportCsvCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersImportCsvCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersImportCsvCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/customers_list_response_body.rb b/lib/VoucherifySdk/models/customers_list_response_body.rb index 05932ac5..bd9fc375 100644 --- a/lib/VoucherifySdk/models/customers_list_response_body.rb +++ b/lib/VoucherifySdk/models/customers_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/customers`. + # Response body schema for **GET** `v1/customers`. class CustomersListResponseBody - # The type of object represented by JSON. This object stores information about customers in a dictionary. + # The type of the object represented by JSON. This object stores information about customers in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of customer objects. @@ -28,7 +28,7 @@ class CustomersListResponseBody # Total number of customers. attr_accessor :total - # As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different end date filter) to get more records returned in the results. + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different end date filter) to get more records returned in the results. attr_accessor :has_more # Attribute mapping from ruby-style variable name to JSON key. @@ -61,21 +61,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'customers', + :'total', + :'has_more' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -95,14 +93,10 @@ def initialize(attributes = {}) if (value = attributes[:'customers']).is_a?(Array) self.customers = value end - else - self.customers = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'has_more') @@ -115,22 +109,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @customers.nil? - invalid_properties.push('invalid value for "customers", customers cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -138,10 +116,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @customers.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_request_body.rb b/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_request_body.rb index 0217cac4..17e43cd5 100644 --- a/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_request_body.rb +++ b/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/customers/metadata/async`. + # Request body schema for **POST** `v1/customers/metadata/async`. class CustomersMetadataUpdateInBulkRequestBody # An array of customer `source_id`'s. attr_accessor :source_ids @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'source_ids', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersMetadataUpdateInBulkRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersMetadataUpdateInBulkRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -68,14 +63,10 @@ def initialize(attributes = {}) if (value = attributes[:'source_ids']).is_a?(Array) self.source_ids = value end - else - self.source_ids = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end end @@ -84,14 +75,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @source_ids.nil? - invalid_properties.push('invalid value for "source_ids", source_ids cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - invalid_properties end @@ -99,8 +82,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @source_ids.nil? - return false if @metadata.nil? true end diff --git a/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_response_body.rb b/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_response_body.rb index 4dc462d8..c46da261 100644 --- a/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_response_body.rb +++ b/lib/VoucherifySdk/models/customers_metadata_update_in_bulk_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/customers/metadata/async`. + # Response body schema for **POST** `v1/customers/metadata/async`. class CustomersMetadataUpdateInBulkResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersMetadataUpdateInBulkResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersMetadataUpdateInBulkResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body.rb b/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body.rb index 8aa4fe05..6e0a2f7c 100644 --- a/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body.rb +++ b/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/customers/{customerId}/permanent-deletion`. + # Response body schema for **POST** `v1/customers/{customerId}/permanent-deletion`. class CustomersPermanentDeletionCreateResponseBody # Unique permanent deletion object ID. attr_accessor :id @@ -33,7 +33,7 @@ class CustomersPermanentDeletionCreateResponseBody attr_accessor :data_json - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Attribute mapping from ruby-style variable name to JSON key. @@ -70,40 +70,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'related_object_id', + :'related_object', + :'status', + :'data_json', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersPermanentDeletionCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersPermanentDeletionCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object') @@ -120,8 +114,6 @@ def initialize(attributes = {}) if attributes.key?(:'data_json') self.data_json = attributes[:'data_json'] - else - self.data_json = nil end if attributes.key?(:'object') @@ -136,34 +128,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object.nil? - invalid_properties.push('invalid value for "related_object", related_object cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @data_json.nil? - invalid_properties.push('invalid value for "data_json", data_json cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -171,13 +135,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @created_at.nil? - return false if @related_object_id.nil? - return false if @related_object.nil? - return false if @status.nil? - return false if @data_json.nil? - return false if @object.nil? true end diff --git a/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body_data_json.rb b/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body_data_json.rb index 0d6f15fa..bf59b427 100644 --- a/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body_data_json.rb +++ b/lib/VoucherifySdk/models/customers_permanent_deletion_create_response_body_data_json.rb @@ -71,58 +71,46 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'events', + :'customer_events', + :'daily_events', + :'segments', + :'orders', + :'order_events', + :'customer' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersPermanentDeletionCreateResponseBodyDataJson` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersPermanentDeletionCreateResponseBodyDataJson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'events') self.events = attributes[:'events'] - else - self.events = nil end if attributes.key?(:'customer_events') self.customer_events = attributes[:'customer_events'] - else - self.customer_events = nil end if attributes.key?(:'daily_events') self.daily_events = attributes[:'daily_events'] - else - self.daily_events = nil end if attributes.key?(:'segments') self.segments = attributes[:'segments'] - else - self.segments = nil end if attributes.key?(:'orders') self.orders = attributes[:'orders'] - else - self.orders = nil end if attributes.key?(:'order_events') self.order_events = attributes[:'order_events'] - else - self.order_events = nil end if attributes.key?(:'customer') @@ -137,34 +125,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @events.nil? - invalid_properties.push('invalid value for "events", events cannot be nil.') - end - - if @customer_events.nil? - invalid_properties.push('invalid value for "customer_events", customer_events cannot be nil.') - end - - if @daily_events.nil? - invalid_properties.push('invalid value for "daily_events", daily_events cannot be nil.') - end - - if @segments.nil? - invalid_properties.push('invalid value for "segments", segments cannot be nil.') - end - - if @orders.nil? - invalid_properties.push('invalid value for "orders", orders cannot be nil.') - end - - if @order_events.nil? - invalid_properties.push('invalid value for "order_events", order_events cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - invalid_properties end @@ -172,13 +132,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @events.nil? - return false if @customer_events.nil? - return false if @daily_events.nil? - return false if @segments.nil? - return false if @orders.nil? - return false if @order_events.nil? - return false if @customer.nil? true end diff --git a/lib/VoucherifySdk/models/customers_redeemables_list_response_body.rb b/lib/VoucherifySdk/models/customers_redeemables_list_response_body.rb new file mode 100644 index 00000000..44c6f212 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_redeemables_list_response_body.rb @@ -0,0 +1,271 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/customers/{customerId}/redeemables`. + class CustomersRedeemablesListResponseBody + # The type of the object represented by JSON. This object stores information about customer redeemables. + attr_accessor :object + + # Identifies the name of the JSON property that contains the array of redeemables. + attr_accessor :data_ref + + # A dictionary that contains an array of redeemables. + attr_accessor :data + + # Total number of results returned. + attr_accessor :total + + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. + attr_accessor :has_more + + # Returns an ID that can be used to return another page of results. Use the ID in the `starting_after_id` query parameter to display another page of the results occuring after the field with that ID. + attr_accessor :more_starting_after + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'total' => :'total', + :'has_more' => :'has_more', + :'more_starting_after' => :'more_starting_after' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'total' => :'Integer', + :'has_more' => :'Boolean', + :'more_starting_after' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'total', + :'has_more', + :'more_starting_after' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'more_starting_after') + self.more_starting_after = attributes[:'more_starting_after'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + total == o.total && + has_more == o.has_more && + more_starting_after == o.more_starting_after + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, total, has_more, more_starting_after].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_segments_list_response_body.rb b/lib/VoucherifySdk/models/customers_segments_list_response_body.rb index c13f91ba..ee7ec7cc 100644 --- a/lib/VoucherifySdk/models/customers_segments_list_response_body.rb +++ b/lib/VoucherifySdk/models/customers_segments_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/customers/{customerId}/segments`. + # Response body schema for **GET** `v1/customers/{customerId}/segments`. class CustomersSegmentsListResponseBody - # The type of object represented by JSON. This object stores information about customer segments. + # The type of the object represented by JSON. This object stores information about customer segments. attr_accessor :object # Identifies the name of the JSON property that contains the array of segment IDs. @@ -56,28 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerSegmentsList' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersSegmentsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersSegmentsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -97,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -113,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -136,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/customers_update_in_bulk_request_body.rb b/lib/VoucherifySdk/models/customers_update_in_bulk_request_body.rb index 401db8fe..1bd7eccc 100644 --- a/lib/VoucherifySdk/models/customers_update_in_bulk_request_body.rb +++ b/lib/VoucherifySdk/models/customers_update_in_bulk_request_body.rb @@ -14,8 +14,11 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/customers/bulk/async`. + # Request body schema for **POST** `v1/customers/bulk/async`. class CustomersUpdateInBulkRequestBody + # Unique customer source ID. + attr_accessor :source_id + # Customer's first and last name. attr_accessor :name @@ -28,7 +31,7 @@ class CustomersUpdateInBulkRequestBody # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -39,12 +42,10 @@ class CustomersUpdateInBulkRequestBody # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. attr_accessor :metadata - # Unique customer source ID. - attr_accessor :source_id - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'source_id' => :'source_id', :'name' => :'name', :'description' => :'description', :'email' => :'email', @@ -52,8 +53,7 @@ def self.attribute_map :'birthday' => :'birthday', :'birthdate' => :'birthdate', :'address' => :'address', - :'metadata' => :'metadata', - :'source_id' => :'source_id' + :'metadata' => :'metadata' } end @@ -65,47 +65,45 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'source_id' => :'String', :'name' => :'String', :'description' => :'String', :'email' => :'String', :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', - :'metadata' => :'Object', - :'source_id' => :'String' + :'address' => :'CustomersUpdateInBulkRequestBodyAddress', + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'source_id', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersUpdateInBulkRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersUpdateInBulkRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + if attributes.key?(:'name') self.name = attributes[:'name'] end @@ -137,12 +135,6 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -150,10 +142,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @source_id.nil? - invalid_properties.push('invalid value for "source_id", source_id cannot be nil.') - end - invalid_properties end @@ -161,7 +149,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @source_id.nil? true end @@ -170,6 +157,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + source_id == o.source_id && name == o.name && description == o.description && email == o.email && @@ -177,8 +165,7 @@ def ==(o) birthday == o.birthday && birthdate == o.birthdate && address == o.address && - metadata == o.metadata && - source_id == o.source_id + metadata == o.metadata end # @see the `==` method @@ -190,7 +177,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, description, email, phone, birthday, birthdate, address, metadata, source_id].hash + [source_id, name, description, email, phone, birthday, birthdate, address, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/customers_update_in_bulk_request_body_address.rb b/lib/VoucherifySdk/models/customers_update_in_bulk_request_body_address.rb new file mode 100644 index 00000000..c742f68f --- /dev/null +++ b/lib/VoucherifySdk/models/customers_update_in_bulk_request_body_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomersUpdateInBulkRequestBodyAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_update_in_bulk_response_body.rb b/lib/VoucherifySdk/models/customers_update_in_bulk_response_body.rb index da5a3a8d..2168bb4d 100644 --- a/lib/VoucherifySdk/models/customers_update_in_bulk_response_body.rb +++ b/lib/VoucherifySdk/models/customers_update_in_bulk_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/customers/bulk/async`. + # Response body schema for **POST** `v1/customers/bulk/async`. class CustomersUpdateInBulkResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersUpdateInBulkResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersUpdateInBulkResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/customers_update_request_body.rb b/lib/VoucherifySdk/models/customers_update_request_body.rb index 7f1a8a29..1050f036 100644 --- a/lib/VoucherifySdk/models/customers_update_request_body.rb +++ b/lib/VoucherifySdk/models/customers_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **PUT** `/customers/{customerId}`. + # Request body schema for **PUT** `v1/customers/{customerId}`. class CustomersUpdateRequestBody # Customer's first and last name. attr_accessor :name @@ -28,7 +28,7 @@ class CustomersUpdateRequestBody # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -67,7 +67,7 @@ def self.openapi_types :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', + :'address' => :'CustomersUpdateRequestBodyAddress', :'metadata' => :'Object' } end @@ -75,29 +75,22 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/customers_update_request_body_address.rb b/lib/VoucherifySdk/models/customers_update_request_body_address.rb new file mode 100644 index 00000000..0e259184 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_update_request_body_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomersUpdateRequestBodyAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_update_response_body.rb b/lib/VoucherifySdk/models/customers_update_response_body.rb index 9805eccb..d0ebe0fc 100644 --- a/lib/VoucherifySdk/models/customers_update_response_body.rb +++ b/lib/VoucherifySdk/models/customers_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/customers/{customerId}`. + # Response body schema for **PUT** `v1/customers/{customerId}`. class CustomersUpdateResponseBody # The ID of an existing customer that will be linked to redemption in this request. attr_accessor :id @@ -31,15 +31,15 @@ class CustomersUpdateResponseBody # Object used to store system metadata information. attr_accessor :system_metadata - # Timestamp representing the date and time when the customer was created in ISO 8601 format. + # Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the customer was updated in ISO 8601 format. + # Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at attr_accessor :assets - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Customer's first and last name. @@ -54,7 +54,7 @@ class CustomersUpdateResponseBody # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -127,7 +127,7 @@ def self.openapi_types :'system_metadata' => :'Object', :'created_at' => :'Time', :'updated_at' => :'Time', - :'assets' => :'CustomerResponseDataAssets', + :'assets' => :'CustomersUpdateResponseBodyAssets', :'object' => :'String', :'name' => :'String', :'description' => :'String', @@ -135,7 +135,7 @@ def self.openapi_types :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', + :'address' => :'CustomersUpdateResponseBodyAddress', :'metadata' => :'Object' } end @@ -143,32 +143,29 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'summary', - :'loyalty', - :'referrals', + :'id', + :'source_id', + :'system_metadata', + :'created_at', + :'updated_at', + :'assets', + :'object', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerWithSummaryLoyaltyReferrals' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::CustomersUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::CustomersUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -182,20 +179,14 @@ def initialize(attributes = {}) if attributes.key?(:'summary') self.summary = attributes[:'summary'] - else - self.summary = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'referrals') self.referrals = attributes[:'referrals'] - else - self.referrals = nil end if attributes.key?(:'system_metadata') @@ -258,10 +249,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -269,22 +256,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["customer"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/customers_update_response_body_address.rb b/lib/VoucherifySdk/models/customers_update_response_body_address.rb new file mode 100644 index 00000000..09a7b3f6 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_update_response_body_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class CustomersUpdateResponseBodyAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/customers_update_response_body_assets.rb b/lib/VoucherifySdk/models/customers_update_response_body_assets.rb new file mode 100644 index 00000000..5dd506e1 --- /dev/null +++ b/lib/VoucherifySdk/models/customers_update_response_body_assets.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the customer's cockpit. + class CustomersUpdateResponseBodyAssets + # Customer's cockpit URL address. + attr_accessor :cockpit_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cockpit_url' => :'cockpit_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'cockpit_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'cockpit_url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'cockpit_url') + self.cockpit_url = attributes[:'cockpit_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cockpit_url == o.cockpit_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cockpit_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/discount.rb b/lib/VoucherifySdk/models/discount.rb index 9fa62de6..5a3f9bb2 100644 --- a/lib/VoucherifySdk/models/discount.rb +++ b/lib/VoucherifySdk/models/discount.rb @@ -14,96 +14,389 @@ require 'time' module VoucherifySdk - # Contains information about discount. - module Discount - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'DiscountAmount', - :'DiscountFixed', - :'DiscountPercent', - :'DiscountUnit', - :'DiscountUnitMultiple' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class Discount + attr_accessor :type + + # Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. + attr_accessor :amount_off + + attr_accessor :amount_off_formula + + # Maximum discount amount per order. + attr_accessor :aggregated_amount_limit + + attr_accessor :effect + + # Flag indicating whether the discount was calculated using a formula. + attr_accessor :is_dynamic + + # Number of units to be granted a full value discount. + attr_accessor :unit_off + + attr_accessor :unit_off_formula + + # The product deemed as free, chosen from product inventory (e.g. time, items). + attr_accessor :unit_type + + attr_accessor :product + + attr_accessor :sku + + attr_accessor :units + + # The percent discount that the customer will receive. + attr_accessor :percent_off + + attr_accessor :percent_off_formula + + # Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + attr_accessor :amount_limit + + # Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. + attr_accessor :fixed_amount + + attr_accessor :fixed_amount_formula + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'amount_off' => :'amount_off', + :'amount_off_formula' => :'amount_off_formula', + :'aggregated_amount_limit' => :'aggregated_amount_limit', + :'effect' => :'effect', + :'is_dynamic' => :'is_dynamic', + :'unit_off' => :'unit_off', + :'unit_off_formula' => :'unit_off_formula', + :'unit_type' => :'unit_type', + :'product' => :'product', + :'sku' => :'sku', + :'units' => :'units', + :'percent_off' => :'percent_off', + :'percent_off_formula' => :'percent_off_formula', + :'amount_limit' => :'amount_limit', + :'fixed_amount' => :'fixed_amount', + :'fixed_amount_formula' => :'fixed_amount_formula' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'amount_off' => :'Float', + :'amount_off_formula' => :'String', + :'aggregated_amount_limit' => :'Integer', + :'effect' => :'String', + :'is_dynamic' => :'Boolean', + :'unit_off' => :'Integer', + :'unit_off_formula' => :'String', + :'unit_type' => :'String', + :'product' => :'SimpleProductDiscountUnit', + :'sku' => :'SimpleSkuDiscountUnit', + :'units' => :'Array', + :'percent_off' => :'Float', + :'percent_off_formula' => :'String', + :'amount_limit' => :'Float', + :'fixed_amount' => :'Float', + :'fixed_amount_formula' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'amount_off', + :'amount_off_formula', + :'aggregated_amount_limit', + :'effect', + :'is_dynamic', + :'unit_off', + :'unit_off_formula', + :'unit_type', + :'units', + :'percent_off', + :'percent_off_formula', + :'amount_limit', + :'fixed_amount', + :'fixed_amount_formula' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'amount_off') + self.amount_off = attributes[:'amount_off'] + end + + if attributes.key?(:'amount_off_formula') + self.amount_off_formula = attributes[:'amount_off_formula'] + end + + if attributes.key?(:'aggregated_amount_limit') + self.aggregated_amount_limit = attributes[:'aggregated_amount_limit'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + + if attributes.key?(:'is_dynamic') + self.is_dynamic = attributes[:'is_dynamic'] + end + + if attributes.key?(:'unit_off') + self.unit_off = attributes[:'unit_off'] + end + + if attributes.key?(:'unit_off_formula') + self.unit_off_formula = attributes[:'unit_off_formula'] + end + + if attributes.key?(:'unit_type') + self.unit_type = attributes[:'unit_type'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'units') + if (value = attributes[:'units']).is_a?(Array) + self.units = value + end + end + + if attributes.key?(:'percent_off') + self.percent_off = attributes[:'percent_off'] + end + + if attributes.key?(:'percent_off_formula') + self.percent_off_formula = attributes[:'percent_off_formula'] + end + + if attributes.key?(:'amount_limit') + self.amount_limit = attributes[:'amount_limit'] + end + + if attributes.key?(:'fixed_amount') + self.fixed_amount = attributes[:'fixed_amount'] + end + + if attributes.key?(:'fixed_amount_formula') + self.fixed_amount_formula = attributes[:'fixed_amount_formula'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AMOUNT", "UNIT", "PERCENT", "FIXED"]) + return false unless type_validator.valid?(@type) + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS", "APPLY_TO_ITEMS_PROPORTIONALLY", "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", "APPLY_TO_ITEMS_BY_QUANTITY", "ADD_MISSING_ITEMS", "ADD_NEW_ITEMS", "ADD_MANY_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + amount_off == o.amount_off && + amount_off_formula == o.amount_off_formula && + aggregated_amount_limit == o.aggregated_amount_limit && + effect == o.effect && + is_dynamic == o.is_dynamic && + unit_off == o.unit_off && + unit_off_formula == o.unit_off_formula && + unit_type == o.unit_type && + product == o.product && + sku == o.sku && + units == o.units && + percent_off == o.percent_off && + percent_off_formula == o.percent_off_formula && + amount_limit == o.amount_limit && + fixed_amount == o.fixed_amount && + fixed_amount_formula == o.fixed_amount_formula + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, amount_off, amount_off_formula, aggregated_amount_limit, effect, is_dynamic, unit_off, unit_off_formula, unit_type, product, sku, units, percent_off, percent_off_formula, amount_limit, fixed_amount, fixed_amount_formula].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/discount_amount.rb b/lib/VoucherifySdk/models/discount_amount.rb deleted file mode 100644 index ea7d343b..00000000 --- a/lib/VoucherifySdk/models/discount_amount.rb +++ /dev/null @@ -1,311 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountAmount - # Defines the type of the voucher. - attr_accessor :type - - # Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. - attr_accessor :amount_off - - attr_accessor :amount_off_formula - - # Maximum discount amount per order. - attr_accessor :aggregated_amount_limit - - attr_accessor :effect - - # Flag indicating whether the discount was calculated using a formula. - attr_accessor :is_dynamic - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'amount_off' => :'amount_off', - :'amount_off_formula' => :'amount_off_formula', - :'aggregated_amount_limit' => :'aggregated_amount_limit', - :'effect' => :'effect', - :'is_dynamic' => :'is_dynamic' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'amount_off' => :'Float', - :'amount_off_formula' => :'String', - :'aggregated_amount_limit' => :'Integer', - :'effect' => :'DiscountAmountVouchersEffectTypes', - :'is_dynamic' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'AMOUNT' - end - - if attributes.key?(:'amount_off') - self.amount_off = attributes[:'amount_off'] - else - self.amount_off = nil - end - - if attributes.key?(:'amount_off_formula') - self.amount_off_formula = attributes[:'amount_off_formula'] - end - - if attributes.key?(:'aggregated_amount_limit') - self.aggregated_amount_limit = attributes[:'aggregated_amount_limit'] - end - - if attributes.key?(:'effect') - self.effect = attributes[:'effect'] - end - - if attributes.key?(:'is_dynamic') - self.is_dynamic = attributes[:'is_dynamic'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @amount_off.nil? - invalid_properties.push('invalid value for "amount_off", amount_off cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["AMOUNT", "UNIT", "PERCENT", "FIXED"]) - return false unless type_validator.valid?(@type) - return false if @amount_off.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AMOUNT", "UNIT", "PERCENT", "FIXED"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - amount_off == o.amount_off && - amount_off_formula == o.amount_off_formula && - aggregated_amount_limit == o.aggregated_amount_limit && - effect == o.effect && - is_dynamic == o.is_dynamic - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, amount_off, amount_off_formula, aggregated_amount_limit, effect, is_dynamic].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/discount_amount_vouchers_effect_types.rb b/lib/VoucherifySdk/models/discount_amount_vouchers_effect_types.rb deleted file mode 100644 index f4be327e..00000000 --- a/lib/VoucherifySdk/models/discount_amount_vouchers_effect_types.rb +++ /dev/null @@ -1,43 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountAmountVouchersEffectTypes - ORDER = "APPLY_TO_ORDER".freeze - ITEMS = "APPLY_TO_ITEMS".freeze - ITEMS_PROPORTIONALLY = "APPLY_TO_ITEMS_PROPORTIONALLY".freeze - ITEMS_PROPORTIONALLY_BY_QUANTITY = "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY".freeze - ITEMS_BY_QUANTITY = "APPLY_TO_ITEMS_BY_QUANTITY".freeze - - def self.all_vars - @all_vars ||= [ORDER, ITEMS, ITEMS_PROPORTIONALLY, ITEMS_PROPORTIONALLY_BY_QUANTITY, ITEMS_BY_QUANTITY].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if DiscountAmountVouchersEffectTypes.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #DiscountAmountVouchersEffectTypes" - end - end -end diff --git a/lib/VoucherifySdk/models/discount_coupons_campaign_voucher.rb b/lib/VoucherifySdk/models/discount_coupons_campaign_voucher.rb deleted file mode 100644 index 4f8e7d91..00000000 --- a/lib/VoucherifySdk/models/discount_coupons_campaign_voucher.rb +++ /dev/null @@ -1,290 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountCouponsCampaignVoucher - # Type of voucher. - attr_accessor :type - - attr_accessor :discount - - attr_accessor :code_config - - attr_accessor :redemption - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'discount' => :'discount', - :'code_config' => :'code_config', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'discount' => :'Discount', - :'code_config' => :'CodeConfig', - :'redemption' => :'CampaignLoyaltyVoucherRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountCouponsCampaignVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountCouponsCampaignVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'DISCOUNT_VOUCHER' - end - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - else - self.discount = nil - end - - if attributes.key?(:'code_config') - self.code_config = attributes[:'code_config'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @discount.nil? - invalid_properties.push('invalid value for "discount", discount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER"]) - return false unless type_validator.valid?(@type) - return false if @discount.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - discount == o.discount && - code_config == o.code_config && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, discount, code_config, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/discount_fixed.rb b/lib/VoucherifySdk/models/discount_fixed.rb deleted file mode 100644 index e0f9ddc1..00000000 --- a/lib/VoucherifySdk/models/discount_fixed.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountFixed - # Defines the type of the voucher. - attr_accessor :type - - # Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. - attr_accessor :fixed_amount - - attr_accessor :fixed_amount_formula - - attr_accessor :effect - - # Flag indicating whether the discount was calculated using a formula. - attr_accessor :is_dynamic - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'fixed_amount' => :'fixed_amount', - :'fixed_amount_formula' => :'fixed_amount_formula', - :'effect' => :'effect', - :'is_dynamic' => :'is_dynamic' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'fixed_amount' => :'Float', - :'fixed_amount_formula' => :'String', - :'effect' => :'DiscountFixedVouchersEffectTypes', - :'is_dynamic' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountFixed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountFixed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'FIXED' - end - - if attributes.key?(:'fixed_amount') - self.fixed_amount = attributes[:'fixed_amount'] - else - self.fixed_amount = nil - end - - if attributes.key?(:'fixed_amount_formula') - self.fixed_amount_formula = attributes[:'fixed_amount_formula'] - end - - if attributes.key?(:'effect') - self.effect = attributes[:'effect'] - end - - if attributes.key?(:'is_dynamic') - self.is_dynamic = attributes[:'is_dynamic'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @fixed_amount.nil? - invalid_properties.push('invalid value for "fixed_amount", fixed_amount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["FIXED"]) - return false unless type_validator.valid?(@type) - return false if @fixed_amount.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["FIXED"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - fixed_amount == o.fixed_amount && - fixed_amount_formula == o.fixed_amount_formula && - effect == o.effect && - is_dynamic == o.is_dynamic - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, fixed_amount, fixed_amount_formula, effect, is_dynamic].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/discount_fixed_vouchers_effect_types.rb b/lib/VoucherifySdk/models/discount_fixed_vouchers_effect_types.rb deleted file mode 100644 index 7794af00..00000000 --- a/lib/VoucherifySdk/models/discount_fixed_vouchers_effect_types.rb +++ /dev/null @@ -1,40 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountFixedVouchersEffectTypes - ORDER = "APPLY_TO_ORDER".freeze - ITEMS = "APPLY_TO_ITEMS".freeze - - def self.all_vars - @all_vars ||= [ORDER, ITEMS].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if DiscountFixedVouchersEffectTypes.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #DiscountFixedVouchersEffectTypes" - end - end -end diff --git a/lib/VoucherifySdk/models/discount_percent.rb b/lib/VoucherifySdk/models/discount_percent.rb deleted file mode 100644 index fdc79422..00000000 --- a/lib/VoucherifySdk/models/discount_percent.rb +++ /dev/null @@ -1,321 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountPercent - # Defines the type of the voucher. - attr_accessor :type - - # The percent discount that the customer will receive. - attr_accessor :percent_off - - attr_accessor :percent_off_formula - - # Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. - attr_accessor :amount_limit - - # Maximum discount amount per order. - attr_accessor :aggregated_amount_limit - - attr_accessor :effect - - # Flag indicating whether the discount was calculated using a formula. - attr_accessor :is_dynamic - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'percent_off' => :'percent_off', - :'percent_off_formula' => :'percent_off_formula', - :'amount_limit' => :'amount_limit', - :'aggregated_amount_limit' => :'aggregated_amount_limit', - :'effect' => :'effect', - :'is_dynamic' => :'is_dynamic' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'percent_off' => :'Float', - :'percent_off_formula' => :'String', - :'amount_limit' => :'Float', - :'aggregated_amount_limit' => :'Integer', - :'effect' => :'DiscountPercentVouchersEffectTypes', - :'is_dynamic' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountPercent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountPercent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PERCENT' - end - - if attributes.key?(:'percent_off') - self.percent_off = attributes[:'percent_off'] - else - self.percent_off = nil - end - - if attributes.key?(:'percent_off_formula') - self.percent_off_formula = attributes[:'percent_off_formula'] - end - - if attributes.key?(:'amount_limit') - self.amount_limit = attributes[:'amount_limit'] - end - - if attributes.key?(:'aggregated_amount_limit') - self.aggregated_amount_limit = attributes[:'aggregated_amount_limit'] - end - - if attributes.key?(:'effect') - self.effect = attributes[:'effect'] - end - - if attributes.key?(:'is_dynamic') - self.is_dynamic = attributes[:'is_dynamic'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @percent_off.nil? - invalid_properties.push('invalid value for "percent_off", percent_off cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PERCENT"]) - return false unless type_validator.valid?(@type) - return false if @percent_off.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PERCENT"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - percent_off == o.percent_off && - percent_off_formula == o.percent_off_formula && - amount_limit == o.amount_limit && - aggregated_amount_limit == o.aggregated_amount_limit && - effect == o.effect && - is_dynamic == o.is_dynamic - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, percent_off, percent_off_formula, amount_limit, aggregated_amount_limit, effect, is_dynamic].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/discount_percent_vouchers_effect_types.rb b/lib/VoucherifySdk/models/discount_percent_vouchers_effect_types.rb deleted file mode 100644 index e6b466fe..00000000 --- a/lib/VoucherifySdk/models/discount_percent_vouchers_effect_types.rb +++ /dev/null @@ -1,40 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountPercentVouchersEffectTypes - ORDER = "APPLY_TO_ORDER".freeze - ITEMS = "APPLY_TO_ITEMS".freeze - - def self.all_vars - @all_vars ||= [ORDER, ITEMS].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if DiscountPercentVouchersEffectTypes.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #DiscountPercentVouchersEffectTypes" - end - end -end diff --git a/lib/VoucherifySdk/models/discount_unit.rb b/lib/VoucherifySdk/models/discount_unit.rb deleted file mode 100644 index dd58916e..00000000 --- a/lib/VoucherifySdk/models/discount_unit.rb +++ /dev/null @@ -1,329 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountUnit - # Discount type. - attr_accessor :type - - # Number of units to be granted a full value discount. - attr_accessor :unit_off - - attr_accessor :unit_off_formula - - attr_accessor :effect - - # The product deemed as free, chosen from product inventory (e.g. time, items). - attr_accessor :unit_type - - attr_accessor :product - - attr_accessor :sku - - # Flag indicating whether the discount was calculated using a formula. - attr_accessor :is_dynamic - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'unit_off' => :'unit_off', - :'unit_off_formula' => :'unit_off_formula', - :'effect' => :'effect', - :'unit_type' => :'unit_type', - :'product' => :'product', - :'sku' => :'sku', - :'is_dynamic' => :'is_dynamic' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'unit_off' => :'Integer', - :'unit_off_formula' => :'String', - :'effect' => :'DiscountUnitVouchersEffectTypes', - :'unit_type' => :'String', - :'product' => :'SimpleProductDiscountUnit', - :'sku' => :'SimpleSkuDiscountUnit', - :'is_dynamic' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountUnit` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountUnit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'UNIT' - end - - if attributes.key?(:'unit_off') - self.unit_off = attributes[:'unit_off'] - end - - if attributes.key?(:'unit_off_formula') - self.unit_off_formula = attributes[:'unit_off_formula'] - end - - if attributes.key?(:'effect') - self.effect = attributes[:'effect'] - end - - if attributes.key?(:'unit_type') - self.unit_type = attributes[:'unit_type'] - else - self.unit_type = nil - end - - if attributes.key?(:'product') - self.product = attributes[:'product'] - end - - if attributes.key?(:'sku') - self.sku = attributes[:'sku'] - end - - if attributes.key?(:'is_dynamic') - self.is_dynamic = attributes[:'is_dynamic'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @unit_type.nil? - invalid_properties.push('invalid value for "unit_type", unit_type cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["UNIT"]) - return false unless type_validator.valid?(@type) - return false if @unit_type.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["UNIT"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - unit_off == o.unit_off && - unit_off_formula == o.unit_off_formula && - effect == o.effect && - unit_type == o.unit_type && - product == o.product && - sku == o.sku && - is_dynamic == o.is_dynamic - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, unit_off, unit_off_formula, effect, unit_type, product, sku, is_dynamic].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/discount_unit_multiple.rb b/lib/VoucherifySdk/models/discount_unit_multiple.rb deleted file mode 100644 index f3aac28f..00000000 --- a/lib/VoucherifySdk/models/discount_unit_multiple.rb +++ /dev/null @@ -1,298 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountUnitMultiple - # Discount type. - attr_accessor :type - - # Defines how the discount is applied to the customer's order. - attr_accessor :effect - - attr_accessor :units - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'effect' => :'effect', - :'units' => :'units' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'effect' => :'String', - :'units' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountUnitMultiple` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountUnitMultiple`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'UNIT' - end - - if attributes.key?(:'effect') - self.effect = attributes[:'effect'] - else - self.effect = 'ADD_MANY_ITEMS' - end - - if attributes.key?(:'units') - if (value = attributes[:'units']).is_a?(Array) - self.units = value - end - else - self.units = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @units.nil? - invalid_properties.push('invalid value for "units", units cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["UNIT"]) - return false unless type_validator.valid?(@type) - effect_validator = EnumAttributeValidator.new('String', ["ADD_MANY_ITEMS"]) - return false unless effect_validator.valid?(@effect) - return false if @units.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["UNIT"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] effect Object to be assigned - def effect=(effect) - validator = EnumAttributeValidator.new('String', ["ADD_MANY_ITEMS"]) - unless validator.valid?(effect) - fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}." - end - @effect = effect - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - effect == o.effect && - units == o.units - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, effect, units].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/discount_unit_multiple_one_unit.rb b/lib/VoucherifySdk/models/discount_unit_multiple_one_unit.rb index 2e4fe919..1187148c 100644 --- a/lib/VoucherifySdk/models/discount_unit_multiple_one_unit.rb +++ b/lib/VoucherifySdk/models/discount_unit_multiple_one_unit.rb @@ -84,21 +84,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'unit_off', + :'unit_off_formula', + :'effect', + :'unit_type', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::DiscountUnitMultipleOneUnit` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::DiscountUnitMultipleOneUnit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if attributes.key?(:'effect') self.effect = attributes[:'effect'] - else - self.effect = nil end if attributes.key?(:'unit_type') self.unit_type = attributes[:'unit_type'] - else - self.unit_type = nil end if attributes.key?(:'product') @@ -136,14 +129,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @effect.nil? - invalid_properties.push('invalid value for "effect", effect cannot be nil.') - end - - if @unit_type.nil? - invalid_properties.push('invalid value for "unit_type", unit_type cannot be nil.') - end - invalid_properties end @@ -151,23 +136,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @effect.nil? effect_validator = EnumAttributeValidator.new('String', ["ADD_NEW_ITEMS", "ADD_MISSING_ITEMS"]) return false unless effect_validator.valid?(@effect) - return false if @unit_type.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] effect Object to be assigned - def effect=(effect) - validator = EnumAttributeValidator.new('String', ["ADD_NEW_ITEMS", "ADD_MISSING_ITEMS"]) - unless validator.valid?(effect) - fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}." - end - @effect = effect - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/discount_unit_vouchers_effect_types.rb b/lib/VoucherifySdk/models/discount_unit_vouchers_effect_types.rb deleted file mode 100644 index e8bb20b9..00000000 --- a/lib/VoucherifySdk/models/discount_unit_vouchers_effect_types.rb +++ /dev/null @@ -1,41 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class DiscountUnitVouchersEffectTypes - MISSING_ITEMS = "ADD_MISSING_ITEMS".freeze - NEW_ITEMS = "ADD_NEW_ITEMS".freeze - MANY_ITEMS = "ADD_MANY_ITEMS".freeze - - def self.all_vars - @all_vars ||= [MISSING_ITEMS, NEW_ITEMS, MANY_ITEMS].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if DiscountUnitVouchersEffectTypes.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #DiscountUnitVouchersEffectTypes" - end - end -end diff --git a/lib/VoucherifySdk/models/earning_rule.rb b/lib/VoucherifySdk/models/earning_rule.rb index 4e54781b..935d0c5b 100644 --- a/lib/VoucherifySdk/models/earning_rule.rb +++ b/lib/VoucherifySdk/models/earning_rule.rb @@ -18,7 +18,7 @@ class EarningRule # Assigned by the Voucherify API, identifies the earning rule object. attr_accessor :id - # Timestamp representing the date and time when the earning rule was created in ISO 8601 format. + # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at attr_accessor :loyalty @@ -29,25 +29,29 @@ class EarningRule attr_accessor :segment + attr_accessor :loyalty_tier + attr_accessor :source - # The type of object represented by JSON. Default is earning_rule. + # The type of the object represented by JSON. Default is earning_rule. attr_accessor :object # For internal use by Voucherify. attr_accessor :automation_id - # Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. attr_accessor :start_date - # Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. attr_accessor :expiration_date attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. attr_accessor :metadata @@ -91,6 +95,7 @@ def self.attribute_map :'event' => :'event', :'custom_event' => :'custom_event', :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', :'source' => :'source', :'object' => :'object', :'automation_id' => :'automation_id', @@ -98,6 +103,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'metadata' => :'metadata', :'validation_rule_id' => :'validation_rule_id', :'updated_at' => :'updated_at', @@ -115,17 +121,19 @@ def self.openapi_types { :'id' => :'String', :'created_at' => :'Time', - :'loyalty' => :'EarningRuleBaseLoyalty', - :'event' => :'EarningRuleEvent', - :'custom_event' => :'EarningRuleBaseCustomEvent', - :'segment' => :'EarningRuleBaseSegment', - :'source' => :'EarningRuleBaseSource', + :'loyalty' => :'EarningRuleLoyalty', + :'event' => :'String', + :'custom_event' => :'EarningRuleCustomEvent', + :'segment' => :'EarningRuleSegment', + :'loyalty_tier' => :'EarningRuleLoyaltyTier', + :'source' => :'EarningRuleSource', :'object' => :'String', :'automation_id' => :'String', :'start_date' => :'String', :'expiration_date' => :'String', - :'validity_timeframe' => :'EarningRuleBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'metadata' => :'Object', :'validation_rule_id' => :'String', :'updated_at' => :'Time', @@ -136,49 +144,42 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'loyalty', + :'custom_event', + :'segment', + :'loyalty_tier', + :'source', + :'object', + :'automation_id', + :'start_date', + :'expiration_date', + :'metadata', :'validation_rule_id', :'updated_at', + :'active' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EarningRuleBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRule` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'event') @@ -193,10 +194,12 @@ def initialize(attributes = {}) self.segment = attributes[:'segment'] end + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end if attributes.key?(:'object') @@ -207,8 +210,6 @@ def initialize(attributes = {}) if attributes.key?(:'automation_id') self.automation_id = attributes[:'automation_id'] - else - self.automation_id = nil end if attributes.key?(:'start_date') @@ -229,28 +230,24 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'validation_rule_id') self.validation_rule_id = attributes[:'validation_rule_id'] - else - self.validation_rule_id = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'active') self.active = attributes[:'active'] - else - self.active = nil end end @@ -259,38 +256,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - if @source.nil? - invalid_properties.push('invalid value for "source", source cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @automation_id.nil? - invalid_properties.push('invalid value for "automation_id", automation_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @active.nil? - invalid_properties.push('invalid value for "active", active cannot be nil.') - end - invalid_properties end @@ -298,29 +263,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @created_at.nil? - return false if @loyalty.nil? - return false if @source.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) return false unless object_validator.valid?(@object) - return false if @automation_id.nil? - return false if @metadata.nil? - return false if @active.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["earning_rule"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -332,6 +279,7 @@ def ==(o) event == o.event && custom_event == o.custom_event && segment == o.segment && + loyalty_tier == o.loyalty_tier && source == o.source && object == o.object && automation_id == o.automation_id && @@ -339,6 +287,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && metadata == o.metadata && validation_rule_id == o.validation_rule_id && updated_at == o.updated_at && @@ -354,7 +303,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, loyalty, event, custom_event, segment, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, metadata, validation_rule_id, updated_at, active].hash + [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 end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/earning_rule_base.rb b/lib/VoucherifySdk/models/earning_rule_base.rb deleted file mode 100644 index 923b854b..00000000 --- a/lib/VoucherifySdk/models/earning_rule_base.rb +++ /dev/null @@ -1,424 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleBase - # Assigned by the Voucherify API, identifies the earning rule object. - attr_accessor :id - - # Timestamp representing the date and time when the earning rule was created in ISO 8601 format. - attr_accessor :created_at - - attr_accessor :loyalty - - attr_accessor :event - - attr_accessor :custom_event - - attr_accessor :segment - - attr_accessor :source - - # The type of object represented by JSON. Default is earning_rule. - attr_accessor :object - - # For internal use by Voucherify. - attr_accessor :automation_id - - # Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. - attr_accessor :start_date - - # Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. - attr_accessor :metadata - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'created_at' => :'created_at', - :'loyalty' => :'loyalty', - :'event' => :'event', - :'custom_event' => :'custom_event', - :'segment' => :'segment', - :'source' => :'source', - :'object' => :'object', - :'automation_id' => :'automation_id', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'created_at' => :'Time', - :'loyalty' => :'EarningRuleBaseLoyalty', - :'event' => :'EarningRuleEvent', - :'custom_event' => :'EarningRuleBaseCustomEvent', - :'segment' => :'EarningRuleBaseSegment', - :'source' => :'EarningRuleBaseSource', - :'object' => :'String', - :'automation_id' => :'String', - :'start_date' => :'String', - :'expiration_date' => :'String', - :'validity_timeframe' => :'EarningRuleBaseValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'loyalty') - self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil - end - - if attributes.key?(:'event') - self.event = attributes[:'event'] - end - - if attributes.key?(:'custom_event') - self.custom_event = attributes[:'custom_event'] - end - - if attributes.key?(:'segment') - self.segment = attributes[:'segment'] - end - - if attributes.key?(:'source') - self.source = attributes[:'source'] - else - self.source = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'earning_rule' - end - - if attributes.key?(:'automation_id') - self.automation_id = attributes[:'automation_id'] - else - self.automation_id = nil - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - if @source.nil? - invalid_properties.push('invalid value for "source", source cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @automation_id.nil? - invalid_properties.push('invalid value for "automation_id", automation_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @created_at.nil? - return false if @loyalty.nil? - return false if @source.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) - return false unless object_validator.valid?(@object) - return false if @automation_id.nil? - return false if @metadata.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["earning_rule"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - created_at == o.created_at && - loyalty == o.loyalty && - event == o.event && - custom_event == o.custom_event && - segment == o.segment && - source == o.source && - object == o.object && - automation_id == o.automation_id && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, created_at, loyalty, event, custom_event, segment, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_base_custom_event.rb b/lib/VoucherifySdk/models/earning_rule_base_custom_event.rb deleted file mode 100644 index 2df9cc62..00000000 --- a/lib/VoucherifySdk/models/earning_rule_base_custom_event.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleBaseCustomEvent - attr_accessor :schema_id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'schema_id' => :'schema_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'schema_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleBaseCustomEvent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleBaseCustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'schema_id') - self.schema_id = attributes[:'schema_id'] - else - self.schema_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @schema_id.nil? - invalid_properties.push('invalid value for "schema_id", schema_id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @schema_id.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - schema_id == o.schema_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [schema_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_base_loyalty.rb b/lib/VoucherifySdk/models/earning_rule_base_loyalty.rb deleted file mode 100644 index 37990736..00000000 --- a/lib/VoucherifySdk/models/earning_rule_base_loyalty.rb +++ /dev/null @@ -1,105 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module EarningRuleBaseLoyalty - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'EarningRuleFixed', - :'EarningRuleProportional' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_base_segment.rb b/lib/VoucherifySdk/models/earning_rule_base_segment.rb deleted file mode 100644 index 62d3dadb..00000000 --- a/lib/VoucherifySdk/models/earning_rule_base_segment.rb +++ /dev/null @@ -1,223 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains the id of a customer segment. Required for the customer.segment.entered option in event. - class EarningRuleBaseSegment - # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. - attr_accessor :id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleBaseSegment` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleBaseSegment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_base_source.rb b/lib/VoucherifySdk/models/earning_rule_base_source.rb deleted file mode 100644 index 756f6947..00000000 --- a/lib/VoucherifySdk/models/earning_rule_base_source.rb +++ /dev/null @@ -1,284 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains the custom earning rule name and parent campaign. - class EarningRuleBaseSource - # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. - attr_accessor :banner - - # A unique campaign identifier assigned by the Voucherify API. - attr_accessor :object_id - - # Defines the object associated with the earning rule. Defaults to `campaign`. - attr_accessor :object_type - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'banner' => :'banner', - :'object_id' => :'object_id', - :'object_type' => :'object_type' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'banner' => :'String', - :'object_id' => :'String', - :'object_type' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleBaseSource` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleBaseSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'banner') - self.banner = attributes[:'banner'] - end - - if attributes.key?(:'object_id') - self.object_id = attributes[:'object_id'] - else - self.object_id = nil - end - - if attributes.key?(:'object_type') - self.object_type = attributes[:'object_type'] - else - self.object_type = 'campaign' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object_id.nil? - invalid_properties.push('invalid value for "object_id", object_id cannot be nil.') - end - - if @object_type.nil? - invalid_properties.push('invalid value for "object_type", object_type cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object_id.nil? - return false if @object_type.nil? - object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) - return false unless object_type_validator.valid?(@object_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object_type Object to be assigned - def object_type=(object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(object_type) - fail ArgumentError, "invalid value for \"object_type\", must be one of #{validator.allowable_values}." - end - @object_type = object_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - banner == o.banner && - object_id == o.object_id && - object_type == o.object_type - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [banner, object_id, object_type].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_base_validity_timeframe.rb b/lib/VoucherifySdk/models/earning_rule_base_validity_timeframe.rb deleted file mode 100644 index b77bbe79..00000000 --- a/lib/VoucherifySdk/models/earning_rule_base_validity_timeframe.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the `validity_timeframe`. - class EarningRuleBaseValidityTimeframe - # Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour. - attr_accessor :duration - - # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day. - attr_accessor :interval - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'duration' => :'duration', - :'interval' => :'interval' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'duration' => :'String', - :'interval' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleBaseValidityTimeframe` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleBaseValidityTimeframe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'duration') - self.duration = attributes[:'duration'] - else - self.duration = nil - end - - if attributes.key?(:'interval') - self.interval = attributes[:'interval'] - else - self.interval = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @duration.nil? - invalid_properties.push('invalid value for "duration", duration cannot be nil.') - end - - if @interval.nil? - invalid_properties.push('invalid value for "interval", interval cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @duration.nil? - return false if @interval.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - duration == o.duration && - interval == o.interval - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [duration, interval].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_custom_event.rb b/lib/VoucherifySdk/models/earning_rule_custom_event.rb new file mode 100644 index 00000000..08409ff4 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the custom event. + class EarningRuleCustomEvent + # Unique identifier of the custom event schema + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_event.rb b/lib/VoucherifySdk/models/earning_rule_event.rb deleted file mode 100644 index e0b2aba4..00000000 --- a/lib/VoucherifySdk/models/earning_rule_event.rb +++ /dev/null @@ -1,46 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleEvent - ORDER_PAID = "order.paid".freeze - CUSTOMER_SEGMENT_ENTERED = "customer.segment.entered".freeze - CUSTOM_EVENT = "custom_event".freeze - CUSTOMER_LOYALTY_TIER_UPGRADED = "customer.loyalty.tier.upgraded".freeze - CUSTOMER_LOYALTY_TIER_DOWNGRADED = "customer.loyalty.tier.downgraded".freeze - CUSTOMER_LOYALTY_TIER_PROLONGED = "customer.loyalty.tier.prolonged".freeze - CUSTOMER_LOYALTY_TIER_JOINED = "customer.loyalty.tier.joined".freeze - CUSTOMER_LOYALTY_TIER_LEFT = "customer.loyalty.tier.left".freeze - - def self.all_vars - @all_vars ||= [ORDER_PAID, CUSTOMER_SEGMENT_ENTERED, CUSTOM_EVENT, CUSTOMER_LOYALTY_TIER_UPGRADED, CUSTOMER_LOYALTY_TIER_DOWNGRADED, CUSTOMER_LOYALTY_TIER_PROLONGED, CUSTOMER_LOYALTY_TIER_JOINED, CUSTOMER_LOYALTY_TIER_LEFT].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if EarningRuleEvent.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #EarningRuleEvent" - end - end -end diff --git a/lib/VoucherifySdk/models/earning_rule_fixed.rb b/lib/VoucherifySdk/models/earning_rule_fixed.rb deleted file mode 100644 index 9237a373..00000000 --- a/lib/VoucherifySdk/models/earning_rule_fixed.rb +++ /dev/null @@ -1,261 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleFixed - # The number of points to be added to the loyalty card. - attr_accessor :type - - # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. - attr_accessor :points - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleFixed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleFixed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'FIXED' - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["FIXED"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["FIXED"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty.rb b/lib/VoucherifySdk/models/earning_rule_loyalty.rb new file mode 100644 index 00000000..0616def9 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class EarningRuleLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'EarningRuleLoyaltyOrder', + :'order_items' => :'EarningRuleLoyaltyOrderItems', + :'customer' => :'EarningRuleLoyaltyCustomer', + :'custom_event' => :'EarningRuleLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_custom_event.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_custom_event.rb new file mode 100644 index 00000000..4568912f --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class EarningRuleLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'EarningRuleLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..0c01b84b --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class EarningRuleLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_customer.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_customer.rb new file mode 100644 index 00000000..3053e3d5 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class EarningRuleLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'EarningRuleLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_customer_metadata.rb new file mode 100644 index 00000000..f67bba4b --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class EarningRuleLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order.rb new file mode 100644 index 00000000..1d9d6fd1 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class EarningRuleLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'EarningRuleLoyaltyOrderAmount', + :'total_amount' => :'EarningRuleLoyaltyOrderTotalAmount', + :'metadata' => :'EarningRuleLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_amount.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_amount.rb new file mode 100644 index 00000000..b5df46ae --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class EarningRuleLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_items.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items.rb new file mode 100644 index 00000000..1404e50e --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class EarningRuleLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'EarningRuleLoyaltyOrderItemsQuantity', + :'amount' => :'EarningRuleLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'EarningRuleLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_amount.rb new file mode 100644 index 00000000..ed1f1822 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class EarningRuleLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..8a887de9 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class EarningRuleLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..44dac408 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class EarningRuleLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_metadata.rb new file mode 100644 index 00000000..7ecf6ab4 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class EarningRuleLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_order_total_amount.rb new file mode 100644 index 00000000..234d5f7f --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class EarningRuleLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_loyalty_tier.rb b/lib/VoucherifySdk/models/earning_rule_loyalty_tier.rb new file mode 100644 index 00000000..3f89d741 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class EarningRuleLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional.rb b/lib/VoucherifySdk/models/earning_rule_proportional.rb deleted file mode 100644 index 34715282..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional.rb +++ /dev/null @@ -1,107 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module EarningRuleProportional - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'EarningRuleProportionalCustomEvent', - :'EarningRuleProportionalCustomerMetadata', - :'EarningRuleProportionalOrder', - :'EarningRuleProportionalOrderItems' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_custom_event.rb b/lib/VoucherifySdk/models/earning_rule_proportional_custom_event.rb deleted file mode 100644 index afef0a27..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_custom_event.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalCustomEvent - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute). - attr_accessor :calculation_type - - attr_accessor :custom_event - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'custom_event' => :'custom_event' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'custom_event' => :'EarningRuleProportionalCustomEventCustomEvent' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalCustomEvent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalCustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'CUSTOM_EVENT_METADATA' - end - - if attributes.key?(:'custom_event') - self.custom_event = attributes[:'custom_event'] - else - self.custom_event = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @custom_event.nil? - invalid_properties.push('invalid value for "custom_event", custom_event cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["CUSTOM_EVENT_METADATA"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @custom_event.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["CUSTOM_EVENT_METADATA"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - custom_event == o.custom_event - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, custom_event].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event.rb b/lib/VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event.rb deleted file mode 100644 index aa902cc6..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalCustomEventCustomEvent - attr_accessor :metadata - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'metadata' => :'EarningRuleProportionalCustomEventCustomEventMetadata' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalCustomEventCustomEvent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalCustomEventCustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @metadata.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event_metadata.rb b/lib/VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event_metadata.rb deleted file mode 100644 index d8ca4954..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_custom_event_custom_event_metadata.rb +++ /dev/null @@ -1,257 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. - class EarningRuleProportionalCustomEventCustomEventMetadata - # For how many increments of the customer metadata property to grant points for. - attr_accessor :every - - # Number of points to be awarded, i.e. how many points to be added to the loyalty card. - attr_accessor :points - - # Custom event metadata property. - attr_accessor :property - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'every' => :'every', - :'points' => :'points', - :'property' => :'property' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'every' => :'Integer', - :'points' => :'Integer', - :'property' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalCustomEventCustomEventMetadata` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalCustomEventCustomEventMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'every') - self.every = attributes[:'every'] - else - self.every = nil - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - - if attributes.key?(:'property') - self.property = attributes[:'property'] - else - self.property = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @every.nil? - invalid_properties.push('invalid value for "every", every cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @property.nil? - invalid_properties.push('invalid value for "property", property cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @every.nil? - return false if @points.nil? - return false if @property.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - every == o.every && - points == o.points && - property == o.property - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [every, points, property].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata.rb b/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata.rb deleted file mode 100644 index 97fc3d9d..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalCustomerMetadata - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object) - attr_accessor :calculation_type - - attr_accessor :customer - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'customer' => :'customer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'customer' => :'EarningRuleProportionalCustomerMetadataCustomer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalCustomerMetadata` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalCustomerMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'CUSTOMER_METADATA' - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["CUSTOMER_METADATA"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @customer.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["CUSTOMER_METADATA"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - customer == o.customer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, customer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer.rb b/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer.rb deleted file mode 100644 index 7b212c36..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalCustomerMetadataCustomer - attr_accessor :metadata - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'metadata' => :'EarningRuleProportionalCustomerMetadataCustomerMetadata' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomer` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @metadata.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer_metadata.rb b/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer_metadata.rb deleted file mode 100644 index 53506524..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_customer_metadata_customer_metadata.rb +++ /dev/null @@ -1,257 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. - class EarningRuleProportionalCustomerMetadataCustomerMetadata - # For how many increments of the customer metadata property to grant points for. - attr_accessor :every - - # Number of points to be awarded, i.e. how many points to be added to the loyalty card. - attr_accessor :points - - # Customer metadata property. - attr_accessor :property - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'every' => :'every', - :'points' => :'points', - :'property' => :'property' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'every' => :'Integer', - :'points' => :'Integer', - :'property' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomerMetadata` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalCustomerMetadataCustomerMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'every') - self.every = attributes[:'every'] - else - self.every = nil - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - - if attributes.key?(:'property') - self.property = attributes[:'property'] - else - self.property = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @every.nil? - invalid_properties.push('invalid value for "every", every cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @property.nil? - invalid_properties.push('invalid value for "property", property cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @every.nil? - return false if @points.nil? - return false if @property.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - every == o.every && - points == o.points && - property == o.property - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [every, points, property].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order.rb deleted file mode 100644 index 4e355386..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order.rb +++ /dev/null @@ -1,106 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module EarningRuleProportionalOrder - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'EarningRuleProportionalOrderAmount', - :'EarningRuleProportionalOrderMetadata', - :'EarningRuleProportionalOrderTotalAmount' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_amount.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_amount.rb deleted file mode 100644 index f666d9fd..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_amount.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderAmount - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # `ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts) - attr_accessor :calculation_type - - attr_accessor :order - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'order' => :'order' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'order' => :'EarningRuleProportionalOrderAmountOrder' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'ORDER_AMOUNT' - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - else - self.order = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @order.nil? - invalid_properties.push('invalid value for "order", order cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @order.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - order == o.order - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, order].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_amount_order.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_amount_order.rb deleted file mode 100644 index 70e1d75e..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_amount_order.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderAmountOrder - attr_accessor :amount - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'amount' => :'amount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'amount' => :'EarningRuleProportionalOrderAmountOrderAmount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderAmountOrder` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderAmountOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - else - self.amount = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @amount.nil? - invalid_properties.push('invalid value for "amount", amount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @amount.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - amount == o.amount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [amount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_amount_order_amount.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_amount_order_amount.rb deleted file mode 100644 index 532ebab4..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_amount_order_amount.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. - class EarningRuleProportionalOrderAmountOrderAmount - # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. - attr_accessor :every - - # Number of points to be awarded, i.e. how many points to be added to the loyalty card. - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'every' => :'every', - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'every' => :'Integer', - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderAmountOrderAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderAmountOrderAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'every') - self.every = attributes[:'every'] - else - self.every = nil - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @every.nil? - invalid_properties.push('invalid value for "every", every cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @every.nil? - return false if @points.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - every == o.every && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [every, points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items.rb deleted file mode 100644 index a270eafc..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items.rb +++ /dev/null @@ -1,106 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module EarningRuleProportionalOrderItems - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'EarningRuleProportionalOrderItemsAmount', - :'EarningRuleProportionalOrderItemsQuantity', - :'EarningRuleProportionalOrderItemsSubtotalAmount' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount.rb deleted file mode 100644 index b2b296c4..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderItemsAmount - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts) - attr_accessor :calculation_type - - attr_accessor :order_items - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'order_items' => :'order_items' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'order_items' => :'EarningRuleProportionalOrderItemsAmountOrderItems' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'ORDER_ITEMS_AMOUNT' - end - - if attributes.key?(:'order_items') - self.order_items = attributes[:'order_items'] - else - self.order_items = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @order_items.nil? - invalid_properties.push('invalid value for "order_items", order_items cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_ITEMS_AMOUNT"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @order_items.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["ORDER_ITEMS_AMOUNT"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - order_items == o.order_items - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, order_items].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items.rb deleted file mode 100644 index 1cb16a20..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderItemsAmountOrderItems - attr_accessor :amount - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'amount' => :'amount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'amount' => :'EarningRuleProportionalOrderItemsAmountOrderItemsAmount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItems` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - else - self.amount = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @amount.nil? - invalid_properties.push('invalid value for "amount", amount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @amount.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - amount == o.amount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [amount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items_amount.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items_amount.rb deleted file mode 100644 index e5dcc30e..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_amount_order_items_amount.rb +++ /dev/null @@ -1,308 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. - class EarningRuleProportionalOrderItemsAmountOrderItemsAmount - # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. - attr_accessor :every - - # Number of points to be awarded, i.e. how many points to be added to the loyalty card. - attr_accessor :points - - # Type of object taken under consideration. - attr_accessor :object - - # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. - attr_accessor :id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'every' => :'every', - :'points' => :'points', - :'object' => :'object', - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'every' => :'Integer', - :'points' => :'Integer', - :'object' => :'String', - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItemsAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsAmountOrderItemsAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'every') - self.every = attributes[:'every'] - else - self.every = nil - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = nil - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @every.nil? - invalid_properties.push('invalid value for "every", every cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @every.nil? - return false if @points.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) - return false unless object_validator.valid?(@object) - return false if @id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - every == o.every && - points == o.points && - object == o.object && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [every, points, object, id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_quantity.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_quantity.rb deleted file mode 100644 index 899faae5..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_quantity.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderItemsQuantity - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # `ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items) - attr_accessor :calculation_type - - attr_accessor :order_items - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'order_items' => :'order_items' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'order_items' => :'EarningRuleProportionalOrderItemsQuantityOrderItems' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsQuantity` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsQuantity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'ORDER_ITEMS_QUANTITY' - end - - if attributes.key?(:'order_items') - self.order_items = attributes[:'order_items'] - else - self.order_items = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @order_items.nil? - invalid_properties.push('invalid value for "order_items", order_items cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_ITEMS_QUANTITY"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @order_items.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["ORDER_ITEMS_QUANTITY"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - order_items == o.order_items - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, order_items].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_quantity_order_items.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_quantity_order_items.rb deleted file mode 100644 index b2fe66b1..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_quantity_order_items.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderItemsQuantityOrderItems - attr_accessor :quantity - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'quantity' => :'quantity' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'quantity' => :'EarningRuleProportionalOrderItemsAmountOrderItemsAmount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsQuantityOrderItems` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsQuantityOrderItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'quantity') - self.quantity = attributes[:'quantity'] - else - self.quantity = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @quantity.nil? - invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @quantity.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - quantity == o.quantity - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [quantity].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount.rb deleted file mode 100644 index 94113729..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderItemsSubtotalAmount - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts) - attr_accessor :calculation_type - - attr_accessor :order_items - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'order_items' => :'order_items' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'order_items' => :'EarningRuleProportionalOrderItemsSubtotalAmountOrderItems' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'ORDER_ITEMS_SUBTOTAL_AMOUNT' - end - - if attributes.key?(:'order_items') - self.order_items = attributes[:'order_items'] - else - self.order_items = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @order_items.nil? - invalid_properties.push('invalid value for "order_items", order_items cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_ITEMS_SUBTOTAL_AMOUNT"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @order_items.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["ORDER_ITEMS_SUBTOTAL_AMOUNT"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - order_items == o.order_items - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, order_items].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount_order_items.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount_order_items.rb deleted file mode 100644 index c5998eb2..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_items_subtotal_amount_order_items.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderItemsSubtotalAmountOrderItems - attr_accessor :subtotal_amount - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'subtotal_amount' => :'subtotal_amount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'subtotal_amount' => :'EarningRuleProportionalOrderItemsAmountOrderItemsAmount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmountOrderItems` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderItemsSubtotalAmountOrderItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'subtotal_amount') - self.subtotal_amount = attributes[:'subtotal_amount'] - else - self.subtotal_amount = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @subtotal_amount.nil? - invalid_properties.push('invalid value for "subtotal_amount", subtotal_amount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @subtotal_amount.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - subtotal_amount == o.subtotal_amount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [subtotal_amount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata.rb deleted file mode 100644 index 100ff253..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderMetadata - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # `ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object) - attr_accessor :calculation_type - - attr_accessor :order - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'order' => :'order' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'order' => :'EarningRuleProportionalOrderMetadataOrder' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderMetadata` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'ORDER_METADATA' - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - else - self.order = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @order.nil? - invalid_properties.push('invalid value for "order", order cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_METADATA"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @order.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["ORDER_METADATA"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - order == o.order - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, order].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata_order.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata_order.rb deleted file mode 100644 index 08f826fb..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata_order.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the formula for calculating points proportionally. - class EarningRuleProportionalOrderMetadataOrder - attr_accessor :metadata - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'metadata' => :'EarningRuleProportionalOrderMetadataOrderMetadata' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderMetadataOrder` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderMetadataOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @metadata.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata_order_metadata.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata_order_metadata.rb deleted file mode 100644 index cdc712c6..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_metadata_order_metadata.rb +++ /dev/null @@ -1,257 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. - class EarningRuleProportionalOrderMetadataOrderMetadata - # For how many increments of the order metadata property to grant points for. - attr_accessor :every - - # Number of points to be awarded, i.e. how many points to be added to the loyalty card. - attr_accessor :points - - # Order metadata property. - attr_accessor :property - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'every' => :'every', - :'points' => :'points', - :'property' => :'property' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'every' => :'Integer', - :'points' => :'Integer', - :'property' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderMetadataOrderMetadata` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderMetadataOrderMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'every') - self.every = attributes[:'every'] - else - self.every = nil - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - - if attributes.key?(:'property') - self.property = attributes[:'property'] - else - self.property = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @every.nil? - invalid_properties.push('invalid value for "every", every cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @property.nil? - invalid_properties.push('invalid value for "property", property cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @every.nil? - return false if @points.nil? - return false if @property.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - every == o.every && - points == o.points && - property == o.property - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [every, points, property].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_total_amount.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_total_amount.rb deleted file mode 100644 index 07b93392..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_total_amount.rb +++ /dev/null @@ -1,301 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderTotalAmount - # Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio. - attr_accessor :type - - # `ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount) - attr_accessor :calculation_type - - attr_accessor :order - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'calculation_type' => :'calculation_type', - :'order' => :'order' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'calculation_type' => :'String', - :'order' => :'EarningRuleProportionalOrderTotalAmountOrder' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderTotalAmount` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderTotalAmount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'PROPORTIONAL' - end - - if attributes.key?(:'calculation_type') - self.calculation_type = attributes[:'calculation_type'] - else - self.calculation_type = 'ORDER_TOTAL_AMOUNT' - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - else - self.order = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @calculation_type.nil? - invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.') - end - - if @order.nil? - invalid_properties.push('invalid value for "order", order cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - return false unless type_validator.valid?(@type) - return false if @calculation_type.nil? - calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_TOTAL_AMOUNT"]) - return false unless calculation_type_validator.valid?(@calculation_type) - return false if @order.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["PROPORTIONAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] calculation_type Object to be assigned - def calculation_type=(calculation_type) - validator = EnumAttributeValidator.new('String', ["ORDER_TOTAL_AMOUNT"]) - unless validator.valid?(calculation_type) - fail ArgumentError, "invalid value for \"calculation_type\", must be one of #{validator.allowable_values}." - end - @calculation_type = calculation_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - calculation_type == o.calculation_type && - order == o.order - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, calculation_type, order].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_proportional_order_total_amount_order.rb b/lib/VoucherifySdk/models/earning_rule_proportional_order_total_amount_order.rb deleted file mode 100644 index 491a5ef2..00000000 --- a/lib/VoucherifySdk/models/earning_rule_proportional_order_total_amount_order.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EarningRuleProportionalOrderTotalAmountOrder - attr_accessor :total_amount - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'total_amount' => :'total_amount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'total_amount' => :'EarningRuleProportionalOrderAmountOrderAmount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRuleProportionalOrderTotalAmountOrder` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EarningRuleProportionalOrderTotalAmountOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'total_amount') - self.total_amount = attributes[:'total_amount'] - else - self.total_amount = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @total_amount.nil? - invalid_properties.push('invalid value for "total_amount", total_amount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @total_amount.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - total_amount == o.total_amount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [total_amount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/earning_rule_segment.rb b/lib/VoucherifySdk/models/earning_rule_segment.rb new file mode 100644 index 00000000..b80755fb --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + class EarningRuleSegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/earning_rule_source.rb b/lib/VoucherifySdk/models/earning_rule_source.rb new file mode 100644 index 00000000..8e81fc21 --- /dev/null +++ b/lib/VoucherifySdk/models/earning_rule_source.rb @@ -0,0 +1,258 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class EarningRuleSource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # A unique campaign identifier assigned by the Voucherify API. + attr_accessor :object_id + + # Defines the object associated with the earning rule. Defaults to `campaign`. + attr_accessor :object_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner', + :'object_id' => :'object_id', + :'object_type' => :'object_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String', + :'object_id' => :'String', + :'object_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner', + :'object_id', + :'object_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'object_id') + self.object_id = attributes[:'object_id'] + end + + if attributes.key?(:'object_type') + self.object_type = attributes[:'object_type'] + else + self.object_type = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless object_type_validator.valid?(@object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner && + object_id == o.object_id && + object_type == o.object_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner, object_id, object_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/error.rb b/lib/VoucherifySdk/models/error.rb index 98a98ff3..2e864f26 100644 --- a/lib/VoucherifySdk/models/error.rb +++ b/lib/VoucherifySdk/models/error.rb @@ -71,52 +71,42 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code', + :'key', + :'message', + :'details', + :'request_id', + :'resource_id', + :'resource_type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Error` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end if attributes.key?(:'key') self.key = attributes[:'key'] - else - self.key = nil end if attributes.key?(:'message') self.message = attributes[:'message'] - else - self.message = nil end if attributes.key?(:'details') self.details = attributes[:'details'] - else - self.details = nil end if attributes.key?(:'request_id') self.request_id = attributes[:'request_id'] - else - self.request_id = nil end if attributes.key?(:'resource_id') @@ -133,26 +123,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - - if @key.nil? - invalid_properties.push('invalid value for "key", key cannot be nil.') - end - - if @message.nil? - invalid_properties.push('invalid value for "message", message cannot be nil.') - end - - if @details.nil? - invalid_properties.push('invalid value for "details", details cannot be nil.') - end - - if @request_id.nil? - invalid_properties.push('invalid value for "request_id", request_id cannot be nil.') - end - invalid_properties end @@ -160,11 +130,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? - return false if @key.nil? - return false if @message.nil? - return false if @details.nil? - return false if @request_id.nil? true end diff --git a/lib/VoucherifySdk/models/event_customer_active_campaign_failed.rb b/lib/VoucherifySdk/models/event_customer_active_campaign_failed.rb deleted file mode 100644 index 225cfaf0..00000000 --- a/lib/VoucherifySdk/models/event_customer_active_campaign_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.activecampaign.failed`. - class EventCustomerActiveCampaignFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerActiveCampaignFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerActiveCampaignFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_active_campaign_recovered.rb b/lib/VoucherifySdk/models/event_customer_active_campaign_recovered.rb deleted file mode 100644 index 4bef7abc..00000000 --- a/lib/VoucherifySdk/models/event_customer_active_campaign_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.activecampaign.recovered`. - class EventCustomerActiveCampaignRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerActiveCampaignRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerActiveCampaignRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_active_campaign_sent.rb b/lib/VoucherifySdk/models/event_customer_active_campaign_sent.rb deleted file mode 100644 index a4676765..00000000 --- a/lib/VoucherifySdk/models/event_customer_active_campaign_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.activecampaign.sent`. - class EventCustomerActiveCampaignSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerActiveCampaignSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerActiveCampaignSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_batch_failed.rb b/lib/VoucherifySdk/models/event_customer_batch_failed.rb deleted file mode 100644 index 171ff9b1..00000000 --- a/lib/VoucherifySdk/models/event_customer_batch_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.batch.failed`. - class EventCustomerBatchFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerBatchFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerBatchFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_batch_recovered.rb b/lib/VoucherifySdk/models/event_customer_batch_recovered.rb deleted file mode 100644 index 6741656f..00000000 --- a/lib/VoucherifySdk/models/event_customer_batch_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.batch.recovered`. - class EventCustomerBatchRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerBatchRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerBatchRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_batch_sent.rb b/lib/VoucherifySdk/models/event_customer_batch_sent.rb deleted file mode 100644 index e8fbabaf..00000000 --- a/lib/VoucherifySdk/models/event_customer_batch_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.batch.sent`. - class EventCustomerBatchSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerBatchSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerBatchSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_braze_failed.rb b/lib/VoucherifySdk/models/event_customer_braze_failed.rb deleted file mode 100644 index 1b5b4727..00000000 --- a/lib/VoucherifySdk/models/event_customer_braze_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.braze.failed`. - class EventCustomerBrazeFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerBrazeFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerBrazeFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_braze_recovered.rb b/lib/VoucherifySdk/models/event_customer_braze_recovered.rb deleted file mode 100644 index 508368e4..00000000 --- a/lib/VoucherifySdk/models/event_customer_braze_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.braze.recovered`. - class EventCustomerBrazeRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerBrazeRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerBrazeRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_braze_sent.rb b/lib/VoucherifySdk/models/event_customer_braze_sent.rb deleted file mode 100644 index a118d7e9..00000000 --- a/lib/VoucherifySdk/models/event_customer_braze_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.braze.sent`. - class EventCustomerBrazeSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerBrazeSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerBrazeSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_confirmed.rb b/lib/VoucherifySdk/models/event_customer_confirmed.rb deleted file mode 100644 index b45ca298..00000000 --- a/lib/VoucherifySdk/models/event_customer_confirmed.rb +++ /dev/null @@ -1,224 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.confirmed`. - class EventCustomerConfirmed - attr_accessor :customer - - attr_accessor :unconfirmed_customer - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'unconfirmed_customer' => :'unconfirmed_customer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'unconfirmed_customer' => :'EventCustomerConfirmedUnconfirmedCustomer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerConfirmed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerConfirmed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'unconfirmed_customer') - self.unconfirmed_customer = attributes[:'unconfirmed_customer'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - unconfirmed_customer == o.unconfirmed_customer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, unconfirmed_customer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_confirmed_unconfirmed_customer.rb b/lib/VoucherifySdk/models/event_customer_confirmed_unconfirmed_customer.rb deleted file mode 100644 index 0edb88f0..00000000 --- a/lib/VoucherifySdk/models/event_customer_confirmed_unconfirmed_customer.rb +++ /dev/null @@ -1,214 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerConfirmedUnconfirmedCustomer - attr_accessor :id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerConfirmedUnconfirmedCustomer` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerConfirmedUnconfirmedCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_consents.rb b/lib/VoucherifySdk/models/event_customer_consents.rb deleted file mode 100644 index 1df4b348..00000000 --- a/lib/VoucherifySdk/models/event_customer_consents.rb +++ /dev/null @@ -1,225 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerConsents - attr_accessor :customer - - attr_accessor :consents - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'consents' => :'consents' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'consents' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerConsents` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerConsents`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'consents') - if (value = attributes[:'consents']).is_a?(Array) - self.consents = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - consents == o.consents - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, consents].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_consents_given.rb b/lib/VoucherifySdk/models/event_customer_consents_given.rb deleted file mode 100644 index 9c0e581e..00000000 --- a/lib/VoucherifySdk/models/event_customer_consents_given.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.consents.given`. - class EventCustomerConsentsGiven - attr_accessor :customer - - attr_accessor :consents - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'consents' => :'consents' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'consents' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerConsents' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerConsentsGiven` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerConsentsGiven`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'consents') - if (value = attributes[:'consents']).is_a?(Array) - self.consents = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - consents == o.consents - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, consents].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_consents_revoked.rb b/lib/VoucherifySdk/models/event_customer_consents_revoked.rb deleted file mode 100644 index 878c1636..00000000 --- a/lib/VoucherifySdk/models/event_customer_consents_revoked.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.consents.revoked`. - class EventCustomerConsentsRevoked - attr_accessor :customer - - attr_accessor :consents - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'consents' => :'consents' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'consents' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerConsents' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerConsentsRevoked` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerConsentsRevoked`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'consents') - if (value = attributes[:'consents']).is_a?(Array) - self.consents = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - consents == o.consents - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, consents].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_created.rb b/lib/VoucherifySdk/models/event_customer_created.rb deleted file mode 100644 index acf47e99..00000000 --- a/lib/VoucherifySdk/models/event_customer_created.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.created`. - class EventCustomerCreated - attr_accessor :customer - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerCreated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerCreated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_custom_event.rb b/lib/VoucherifySdk/models/event_customer_custom_event.rb deleted file mode 100644 index 101555c6..00000000 --- a/lib/VoucherifySdk/models/event_customer_custom_event.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.custom_event`. - class EventCustomerCustomEvent - attr_accessor :customer - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerCustomEvent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerCustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_deleted.rb b/lib/VoucherifySdk/models/event_customer_deleted.rb deleted file mode 100644 index 0bfabd19..00000000 --- a/lib/VoucherifySdk/models/event_customer_deleted.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.deleted`. - class EventCustomerDeleted - attr_accessor :customer - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerDeleted` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerDeleted`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_email_failed.rb b/lib/VoucherifySdk/models/event_customer_email_failed.rb deleted file mode 100644 index 110161d9..00000000 --- a/lib/VoucherifySdk/models/event_customer_email_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.email.failed`. - class EventCustomerEmailFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerEmailFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerEmailFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_email_recovered.rb b/lib/VoucherifySdk/models/event_customer_email_recovered.rb deleted file mode 100644 index e75dbac1..00000000 --- a/lib/VoucherifySdk/models/event_customer_email_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.email.recovered`. - class EventCustomerEmailRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerEmailRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerEmailRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_email_sent.rb b/lib/VoucherifySdk/models/event_customer_email_sent.rb deleted file mode 100644 index b8791ab5..00000000 --- a/lib/VoucherifySdk/models/event_customer_email_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.email.sent`. - class EventCustomerEmailSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerEmailSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerEmailSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_failed.rb b/lib/VoucherifySdk/models/event_customer_failed.rb deleted file mode 100644 index 094645ac..00000000 --- a/lib/VoucherifySdk/models/event_customer_failed.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_gift_voucher_balance_added.rb b/lib/VoucherifySdk/models/event_customer_gift_voucher_balance_added.rb deleted file mode 100644 index 28927021..00000000 --- a/lib/VoucherifySdk/models/event_customer_gift_voucher_balance_added.rb +++ /dev/null @@ -1,251 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.voucher.gift.balance_added`. - class EventCustomerGiftVoucherBalanceAdded - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :balance - - attr_accessor :transaction - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'balance' => :'balance', - :'transaction' => :'transaction' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'balance' => :'Integer', - :'transaction' => :'VoucherTransaction' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerGiftVoucherBalanceAdded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerGiftVoucherBalanceAdded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - - if attributes.key?(:'transaction') - self.transaction = attributes[:'transaction'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - voucher == o.voucher && - balance == o.balance && - transaction == o.transaction - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, voucher, balance, transaction].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_intercom_failed.rb b/lib/VoucherifySdk/models/event_customer_intercom_failed.rb deleted file mode 100644 index 778cb74b..00000000 --- a/lib/VoucherifySdk/models/event_customer_intercom_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.intercom.failed`. - class EventCustomerIntercomFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerIntercomFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerIntercomFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_intercom_recovered.rb b/lib/VoucherifySdk/models/event_customer_intercom_recovered.rb deleted file mode 100644 index e1b5897e..00000000 --- a/lib/VoucherifySdk/models/event_customer_intercom_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.intercom.recovered`. - class EventCustomerIntercomRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerIntercomRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerIntercomRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_intercom_sent.rb b/lib/VoucherifySdk/models/event_customer_intercom_sent.rb deleted file mode 100644 index da33154b..00000000 --- a/lib/VoucherifySdk/models/event_customer_intercom_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.intercom.sent`. - class EventCustomerIntercomSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerIntercomSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerIntercomSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_klaviyo_failed.rb b/lib/VoucherifySdk/models/event_customer_klaviyo_failed.rb deleted file mode 100644 index 8739f0e3..00000000 --- a/lib/VoucherifySdk/models/event_customer_klaviyo_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.klaviyo.failed`. - class EventCustomerKlaviyoFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerKlaviyoFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerKlaviyoFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_klaviyo_recovered.rb b/lib/VoucherifySdk/models/event_customer_klaviyo_recovered.rb deleted file mode 100644 index f55cf1ed..00000000 --- a/lib/VoucherifySdk/models/event_customer_klaviyo_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.klaviyo.recovered`. - class EventCustomerKlaviyoRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerKlaviyoRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerKlaviyoRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_klaviyo_sent.rb b/lib/VoucherifySdk/models/event_customer_klaviyo_sent.rb deleted file mode 100644 index 554a0451..00000000 --- a/lib/VoucherifySdk/models/event_customer_klaviyo_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.klaviyo.sent`. - class EventCustomerKlaviyoSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerKlaviyoSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerKlaviyoSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_card_points_added.rb b/lib/VoucherifySdk/models/event_customer_loyalty_card_points_added.rb deleted file mode 100644 index 748ae6f7..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_card_points_added.rb +++ /dev/null @@ -1,251 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.voucher.loyalty_card.points_added`. - class EventCustomerLoyaltyCardPointsAdded - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :balance - - attr_accessor :transaction - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'balance' => :'balance', - :'transaction' => :'transaction' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'balance' => :'Integer', - :'transaction' => :'VoucherTransaction' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyCardPointsAdded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyCardPointsAdded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - - if attributes.key?(:'transaction') - self.transaction = attributes[:'transaction'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - voucher == o.voucher && - balance == o.balance && - transaction == o.transaction - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, voucher, balance, transaction].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_card_points_transferred.rb b/lib/VoucherifySdk/models/event_customer_loyalty_card_points_transferred.rb deleted file mode 100644 index 72b05799..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_card_points_transferred.rb +++ /dev/null @@ -1,269 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.voucher.loyalty_card.points_transferred`. - class EventCustomerLoyaltyCardPointsTransferred - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :source_voucher - - attr_accessor :destination_voucher - - attr_accessor :balance - - attr_accessor :transaction - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'source_voucher' => :'source_voucher', - :'destination_voucher' => :'destination_voucher', - :'balance' => :'balance', - :'transaction' => :'transaction' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'source_voucher' => :'SimpleVoucher', - :'destination_voucher' => :'SimpleVoucher', - :'balance' => :'Integer', - :'transaction' => :'VoucherTransaction' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyCardPointsTransferred` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyCardPointsTransferred`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'source_voucher') - self.source_voucher = attributes[:'source_voucher'] - end - - if attributes.key?(:'destination_voucher') - self.destination_voucher = attributes[:'destination_voucher'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - - if attributes.key?(:'transaction') - self.transaction = attributes[:'transaction'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - voucher == o.voucher && - source_voucher == o.source_voucher && - destination_voucher == o.destination_voucher && - balance == o.balance && - transaction == o.transaction - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, voucher, source_voucher, destination_voucher, balance, transaction].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_base.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_base.rb deleted file mode 100644 index 366c669a..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_base.rb +++ /dev/null @@ -1,223 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerLoyaltyTierBase - attr_accessor :customer - - attr_accessor :campaign - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_downgraded.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_downgraded.rb deleted file mode 100644 index 854760a3..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_downgraded.rb +++ /dev/null @@ -1,279 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.tier.downgraded`. - class EventCustomerLoyaltyTierDowngraded - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty_tier_from - - attr_accessor :loyalty_tier_to - - attr_accessor :created_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty_tier_from' => :'loyalty_tier_from', - :'loyalty_tier_to' => :'loyalty_tier_to', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier_from' => :'LoyaltyTier', - :'loyalty_tier_to' => :'LoyaltyTier', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerLoyaltyTierBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierDowngraded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierDowngraded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier_from') - self.loyalty_tier_from = attributes[:'loyalty_tier_from'] - else - self.loyalty_tier_from = nil - end - - if attributes.key?(:'loyalty_tier_to') - self.loyalty_tier_to = attributes[:'loyalty_tier_to'] - else - self.loyalty_tier_to = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty_tier_from.nil? - invalid_properties.push('invalid value for "loyalty_tier_from", loyalty_tier_from cannot be nil.') - end - - if @loyalty_tier_to.nil? - invalid_properties.push('invalid value for "loyalty_tier_to", loyalty_tier_to cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty_tier_from.nil? - return false if @loyalty_tier_to.nil? - return false if @created_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty_tier_from == o.loyalty_tier_from && - loyalty_tier_to == o.loyalty_tier_to && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty_tier_from, loyalty_tier_to, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_expiration_changed.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_expiration_changed.rb deleted file mode 100644 index 25dc50bb..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_expiration_changed.rb +++ /dev/null @@ -1,279 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.tier.expiration.changed`. - class EventCustomerLoyaltyTierExpirationChanged - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty_tier - - attr_accessor :created_at - - attr_accessor :expiration_date - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty_tier' => :'loyalty_tier', - :'created_at' => :'created_at', - :'expiration_date' => :'expiration_date' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier' => :'LoyaltyTier', - :'created_at' => :'Time', - :'expiration_date' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerLoyaltyTierBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierExpirationChanged` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierExpirationChanged`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier') - self.loyalty_tier = attributes[:'loyalty_tier'] - else - self.loyalty_tier = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - else - self.expiration_date = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty_tier.nil? - invalid_properties.push('invalid value for "loyalty_tier", loyalty_tier cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @expiration_date.nil? - invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty_tier.nil? - return false if @created_at.nil? - return false if @expiration_date.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty_tier == o.loyalty_tier && - created_at == o.created_at && - expiration_date == o.expiration_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty_tier, created_at, expiration_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_joined.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_joined.rb deleted file mode 100644 index 27e75916..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_joined.rb +++ /dev/null @@ -1,263 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.tier.joined`. - class EventCustomerLoyaltyTierJoined - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty_tier - - attr_accessor :created_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty_tier' => :'loyalty_tier', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier' => :'LoyaltyTier', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerLoyaltyTierBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierJoined` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierJoined`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier') - self.loyalty_tier = attributes[:'loyalty_tier'] - else - self.loyalty_tier = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty_tier.nil? - invalid_properties.push('invalid value for "loyalty_tier", loyalty_tier cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty_tier.nil? - return false if @created_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty_tier == o.loyalty_tier && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty_tier, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_left.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_left.rb deleted file mode 100644 index 342ccb6e..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_left.rb +++ /dev/null @@ -1,263 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.tier.left`. - class EventCustomerLoyaltyTierLeft - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty_tier - - attr_accessor :created_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty_tier' => :'loyalty_tier', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier' => :'LoyaltyTier', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerLoyaltyTierBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierLeft` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierLeft`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier') - self.loyalty_tier = attributes[:'loyalty_tier'] - else - self.loyalty_tier = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty_tier.nil? - invalid_properties.push('invalid value for "loyalty_tier", loyalty_tier cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty_tier.nil? - return false if @created_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty_tier == o.loyalty_tier && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty_tier, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_prolonged.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_prolonged.rb deleted file mode 100644 index dbe7ca8a..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_prolonged.rb +++ /dev/null @@ -1,263 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.tier.prolonged`. - class EventCustomerLoyaltyTierProlonged - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty_tier - - attr_accessor :created_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty_tier' => :'loyalty_tier', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier' => :'LoyaltyTier', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerLoyaltyTierBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierProlonged` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierProlonged`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier') - self.loyalty_tier = attributes[:'loyalty_tier'] - else - self.loyalty_tier = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty_tier.nil? - invalid_properties.push('invalid value for "loyalty_tier", loyalty_tier cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty_tier.nil? - return false if @created_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty_tier == o.loyalty_tier && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty_tier, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_tier_upgraded.rb b/lib/VoucherifySdk/models/event_customer_loyalty_tier_upgraded.rb deleted file mode 100644 index 95b3b5f3..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_tier_upgraded.rb +++ /dev/null @@ -1,272 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.tier.upgraded`. - class EventCustomerLoyaltyTierUpgraded - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty_tier_from - - attr_accessor :loyalty_tier_to - - attr_accessor :created_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty_tier_from' => :'loyalty_tier_from', - :'loyalty_tier_to' => :'loyalty_tier_to', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier_from' => :'LoyaltyTier', - :'loyalty_tier_to' => :'LoyaltyTier', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerLoyaltyTierBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyTierUpgraded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyTierUpgraded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier_from') - self.loyalty_tier_from = attributes[:'loyalty_tier_from'] - end - - if attributes.key?(:'loyalty_tier_to') - self.loyalty_tier_to = attributes[:'loyalty_tier_to'] - else - self.loyalty_tier_to = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty_tier_to.nil? - invalid_properties.push('invalid value for "loyalty_tier_to", loyalty_tier_to cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty_tier_to.nil? - return false if @created_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty_tier_from == o.loyalty_tier_from && - loyalty_tier_to == o.loyalty_tier_to && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty_tier_from, loyalty_tier_to, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_loyalty_updated.rb b/lib/VoucherifySdk/models/event_customer_loyalty_updated.rb deleted file mode 100644 index e036d93d..00000000 --- a/lib/VoucherifySdk/models/event_customer_loyalty_updated.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.loyalty.updated`. - class EventCustomerLoyaltyUpdated - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :loyalty - - attr_accessor :created_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'loyalty' => :'loyalty', - :'created_at' => :'created_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'loyalty' => :'Object', - :'created_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerLoyaltyUpdated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerLoyaltyUpdated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty') - self.loyalty = attributes[:'loyalty'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @created_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - loyalty == o.loyalty && - created_at == o.created_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, loyalty, created_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_mailchimp_failed.rb b/lib/VoucherifySdk/models/event_customer_mailchimp_failed.rb deleted file mode 100644 index 4394556f..00000000 --- a/lib/VoucherifySdk/models/event_customer_mailchimp_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.mailchimp.failed`. - class EventCustomerMailchimpFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerMailchimpFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerMailchimpFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_mailchimp_recovered.rb b/lib/VoucherifySdk/models/event_customer_mailchimp_recovered.rb deleted file mode 100644 index 9f61aea0..00000000 --- a/lib/VoucherifySdk/models/event_customer_mailchimp_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.mailchimp.recovered`. - class EventCustomerMailchimpRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerMailchimpRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerMailchimpRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_mailchimp_sent.rb b/lib/VoucherifySdk/models/event_customer_mailchimp_sent.rb deleted file mode 100644 index 91f9865b..00000000 --- a/lib/VoucherifySdk/models/event_customer_mailchimp_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.mailchimp.sent`. - class EventCustomerMailchimpSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerMailchimpSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerMailchimpSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order.rb b/lib/VoucherifySdk/models/event_customer_order.rb deleted file mode 100644 index 5c0d999b..00000000 --- a/lib/VoucherifySdk/models/event_customer_order.rb +++ /dev/null @@ -1,241 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerOrder - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrder` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order_canceled.rb b/lib/VoucherifySdk/models/event_customer_order_canceled.rb deleted file mode 100644 index fe1b142d..00000000 --- a/lib/VoucherifySdk/models/event_customer_order_canceled.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.order.canceled`. - class EventCustomerOrderCanceled - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerOrder' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrderCanceled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrderCanceled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order_created.rb b/lib/VoucherifySdk/models/event_customer_order_created.rb deleted file mode 100644 index 3b0f6849..00000000 --- a/lib/VoucherifySdk/models/event_customer_order_created.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.order.created`. - class EventCustomerOrderCreated - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerOrder' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrderCreated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrderCreated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order_fulfilled.rb b/lib/VoucherifySdk/models/event_customer_order_fulfilled.rb deleted file mode 100644 index 28bb3ea5..00000000 --- a/lib/VoucherifySdk/models/event_customer_order_fulfilled.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.order.fulfilled`. - class EventCustomerOrderFulfilled - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerOrder' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrderFulfilled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrderFulfilled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order_paid.rb b/lib/VoucherifySdk/models/event_customer_order_paid.rb deleted file mode 100644 index a7d41449..00000000 --- a/lib/VoucherifySdk/models/event_customer_order_paid.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.order.paid`. - class EventCustomerOrderPaid - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerOrder' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrderPaid` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrderPaid`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order_processing.rb b/lib/VoucherifySdk/models/event_customer_order_processing.rb deleted file mode 100644 index 70cda7c8..00000000 --- a/lib/VoucherifySdk/models/event_customer_order_processing.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.order.processing`. - class EventCustomerOrderProcessing - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerOrder' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrderProcessing` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrderProcessing`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_order_updated.rb b/lib/VoucherifySdk/models/event_customer_order_updated.rb deleted file mode 100644 index 255f26f4..00000000 --- a/lib/VoucherifySdk/models/event_customer_order_updated.rb +++ /dev/null @@ -1,249 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.order.updated`. - class EventCustomerOrderUpdated - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :order - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'order' => :'order', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'order' => :'OrderCalculated', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerOrder' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerOrderUpdated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerOrderUpdated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - order == o.order && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, order, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_publication_failed.rb b/lib/VoucherifySdk/models/event_customer_publication_failed.rb deleted file mode 100644 index 004fdded..00000000 --- a/lib/VoucherifySdk/models/event_customer_publication_failed.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.publication.failed`. - class EventCustomerPublicationFailed - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :publication - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'publication' => :'publication' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'publication' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerPublicationFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerPublicationFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'publication') - self.publication = attributes[:'publication'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - publication == o.publication - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, publication].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_publication_succeeded.rb b/lib/VoucherifySdk/models/event_customer_publication_succeeded.rb deleted file mode 100644 index e66ed773..00000000 --- a/lib/VoucherifySdk/models/event_customer_publication_succeeded.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.publication.succeeded`. - class EventCustomerPublicationSucceeded - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :publication - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'publication' => :'publication' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'publication' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerPublicationSucceeded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerPublicationSucceeded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'publication') - self.publication = attributes[:'publication'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - publication == o.publication - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, publication].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_recovered.rb b/lib/VoucherifySdk/models/event_customer_recovered.rb deleted file mode 100644 index 2501513b..00000000 --- a/lib/VoucherifySdk/models/event_customer_recovered.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_redemption.rb b/lib/VoucherifySdk/models/event_customer_redemption.rb deleted file mode 100644 index 43ffba41..00000000 --- a/lib/VoucherifySdk/models/event_customer_redemption.rb +++ /dev/null @@ -1,268 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerRedemption - attr_accessor :customer - - attr_accessor :order - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :holder - - attr_accessor :promotion_tier - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'order' => :'order', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'holder' => :'holder', - :'promotion_tier' => :'promotion_tier', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'order' => :'SimpleOrder', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'holder' => :'SimpleCustomer', - :'promotion_tier' => :'SimplePromotionTier', - :'redemption' => :'SimpleRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRedemption` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - order == o.order && - campaign == o.campaign && - voucher == o.voucher && - holder == o.holder && - promotion_tier == o.promotion_tier && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, order, campaign, voucher, holder, promotion_tier, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_redemption_failed.rb b/lib/VoucherifySdk/models/event_customer_redemption_failed.rb deleted file mode 100644 index ece2772d..00000000 --- a/lib/VoucherifySdk/models/event_customer_redemption_failed.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.redemption.failed`. - class EventCustomerRedemptionFailed - attr_accessor :customer - - attr_accessor :order - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :holder - - attr_accessor :promotion_tier - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'order' => :'order', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'holder' => :'holder', - :'promotion_tier' => :'promotion_tier', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'order' => :'SimpleOrder', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'holder' => :'SimpleCustomer', - :'promotion_tier' => :'SimplePromotionTier', - :'redemption' => :'SimpleRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRedemption' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRedemptionFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRedemptionFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - order == o.order && - campaign == o.campaign && - voucher == o.voucher && - holder == o.holder && - promotion_tier == o.promotion_tier && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, order, campaign, voucher, holder, promotion_tier, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_redemption_rollback_failed.rb b/lib/VoucherifySdk/models/event_customer_redemption_rollback_failed.rb deleted file mode 100644 index 01f0c134..00000000 --- a/lib/VoucherifySdk/models/event_customer_redemption_rollback_failed.rb +++ /dev/null @@ -1,285 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.redemption.rollback.failed`. - class EventCustomerRedemptionRollbackFailed - attr_accessor :customer - - attr_accessor :order - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :holder - - attr_accessor :promotion_tier - - attr_accessor :redemption - - attr_accessor :redemption_rollback - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'order' => :'order', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'holder' => :'holder', - :'promotion_tier' => :'promotion_tier', - :'redemption' => :'redemption', - :'redemption_rollback' => :'redemption_rollback' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'order' => :'SimpleOrder', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'holder' => :'SimpleCustomer', - :'promotion_tier' => :'SimplePromotionTier', - :'redemption' => :'SimpleRedemption', - :'redemption_rollback' => :'SimpleRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRedemption' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRedemptionRollbackFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRedemptionRollbackFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'redemption_rollback') - self.redemption_rollback = attributes[:'redemption_rollback'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - order == o.order && - campaign == o.campaign && - voucher == o.voucher && - holder == o.holder && - promotion_tier == o.promotion_tier && - redemption == o.redemption && - redemption_rollback == o.redemption_rollback - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, order, campaign, voucher, holder, promotion_tier, redemption, redemption_rollback].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_redemption_rollback_succeeded.rb b/lib/VoucherifySdk/models/event_customer_redemption_rollback_succeeded.rb deleted file mode 100644 index 779f7b96..00000000 --- a/lib/VoucherifySdk/models/event_customer_redemption_rollback_succeeded.rb +++ /dev/null @@ -1,285 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.redemption.rollback.succeeded`. - class EventCustomerRedemptionRollbackSucceeded - attr_accessor :customer - - attr_accessor :order - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :holder - - attr_accessor :promotion_tier - - attr_accessor :redemption - - attr_accessor :redemption_rollback - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'order' => :'order', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'holder' => :'holder', - :'promotion_tier' => :'promotion_tier', - :'redemption' => :'redemption', - :'redemption_rollback' => :'redemption_rollback' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'order' => :'SimpleOrder', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'holder' => :'SimpleCustomer', - :'promotion_tier' => :'SimplePromotionTier', - :'redemption' => :'SimpleRedemption', - :'redemption_rollback' => :'SimpleRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRedemption' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRedemptionRollbackSucceeded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRedemptionRollbackSucceeded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'redemption_rollback') - self.redemption_rollback = attributes[:'redemption_rollback'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - order == o.order && - campaign == o.campaign && - voucher == o.voucher && - holder == o.holder && - promotion_tier == o.promotion_tier && - redemption == o.redemption && - redemption_rollback == o.redemption_rollback - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, order, campaign, voucher, holder, promotion_tier, redemption, redemption_rollback].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_redemption_succeeded.rb b/lib/VoucherifySdk/models/event_customer_redemption_succeeded.rb deleted file mode 100644 index 322f8039..00000000 --- a/lib/VoucherifySdk/models/event_customer_redemption_succeeded.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.redemption.succeeded`. - class EventCustomerRedemptionSucceeded - attr_accessor :customer - - attr_accessor :order - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :holder - - attr_accessor :promotion_tier - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'order' => :'order', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'holder' => :'holder', - :'promotion_tier' => :'promotion_tier', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'order' => :'SimpleOrder', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'holder' => :'SimpleCustomer', - :'promotion_tier' => :'SimplePromotionTier', - :'redemption' => :'SimpleRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRedemption' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRedemptionSucceeded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRedemptionSucceeded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - order == o.order && - campaign == o.campaign && - voucher == o.voucher && - holder == o.holder && - promotion_tier == o.promotion_tier && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, order, campaign, voucher, holder, promotion_tier, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_referred.rb b/lib/VoucherifySdk/models/event_customer_referred.rb deleted file mode 100644 index 54e39c75..00000000 --- a/lib/VoucherifySdk/models/event_customer_referred.rb +++ /dev/null @@ -1,288 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.referred`. - class EventCustomerReferred - attr_accessor :customer - - attr_accessor :referrer - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :custom_event - - attr_accessor :redemption - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'referrer' => :'referrer', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'custom_event' => :'custom_event', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'referrer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'custom_event' => :'CustomEvent', - :'redemption' => :'RedemptionInternal' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerReferred` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerReferred`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - else - self.referrer = nil - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - else - self.campaign = nil - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - else - self.voucher = nil - end - - if attributes.key?(:'custom_event') - self.custom_event = attributes[:'custom_event'] - else - self.custom_event = nil - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @referrer.nil? - invalid_properties.push('invalid value for "referrer", referrer cannot be nil.') - end - - if @campaign.nil? - invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') - end - - if @voucher.nil? - invalid_properties.push('invalid value for "voucher", voucher cannot be nil.') - end - - if @custom_event.nil? - invalid_properties.push('invalid value for "custom_event", custom_event cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @referrer.nil? - return false if @campaign.nil? - return false if @voucher.nil? - return false if @custom_event.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - referrer == o.referrer && - campaign == o.campaign && - voucher == o.voucher && - custom_event == o.custom_event && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, referrer, campaign, voucher, custom_event, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_reward_redemptions.rb b/lib/VoucherifySdk/models/event_customer_reward_redemptions.rb deleted file mode 100644 index d095fbbe..00000000 --- a/lib/VoucherifySdk/models/event_customer_reward_redemptions.rb +++ /dev/null @@ -1,286 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerRewardRedemptions - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :reward_redemption - - attr_accessor :reward - - attr_accessor :reward_assignment - - attr_accessor :source - - attr_accessor :balance - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'reward_redemption' => :'reward_redemption', - :'reward' => :'reward', - :'reward_assignment' => :'reward_assignment', - :'source' => :'source', - :'balance' => :'balance' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'reward_redemption' => :'Object', - :'reward' => :'SimpleRedemptionRewardResult', - :'reward_assignment' => :'RewardAssignment', - :'source' => :'String', - :'balance' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewardRedemptions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewardRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'reward_redemption') - self.reward_redemption = attributes[:'reward_redemption'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'reward_assignment') - self.reward_assignment = attributes[:'reward_assignment'] - end - - if attributes.key?(:'source') - self.source = attributes[:'source'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - reward_redemption == o.reward_redemption && - reward == o.reward && - reward_assignment == o.reward_assignment && - source == o.source && - balance == o.balance - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, reward_redemption, reward, reward_assignment, source, balance].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_reward_redemptions_completed.rb b/lib/VoucherifySdk/models/event_customer_reward_redemptions_completed.rb deleted file mode 100644 index 3aab7014..00000000 --- a/lib/VoucherifySdk/models/event_customer_reward_redemptions_completed.rb +++ /dev/null @@ -1,294 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.reward_redemptions.completed`. - class EventCustomerRewardRedemptionsCompleted - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :reward_redemption - - attr_accessor :reward - - attr_accessor :reward_assignment - - attr_accessor :source - - attr_accessor :balance - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'reward_redemption' => :'reward_redemption', - :'reward' => :'reward', - :'reward_assignment' => :'reward_assignment', - :'source' => :'source', - :'balance' => :'balance' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'reward_redemption' => :'Object', - :'reward' => :'SimpleRedemptionRewardResult', - :'reward_assignment' => :'RewardAssignment', - :'source' => :'String', - :'balance' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRewardRedemptions' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewardRedemptionsCompleted` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewardRedemptionsCompleted`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'reward_redemption') - self.reward_redemption = attributes[:'reward_redemption'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'reward_assignment') - self.reward_assignment = attributes[:'reward_assignment'] - end - - if attributes.key?(:'source') - self.source = attributes[:'source'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - reward_redemption == o.reward_redemption && - reward == o.reward && - reward_assignment == o.reward_assignment && - source == o.source && - balance == o.balance - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, reward_redemption, reward, reward_assignment, source, balance].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_reward_redemptions_created.rb b/lib/VoucherifySdk/models/event_customer_reward_redemptions_created.rb deleted file mode 100644 index 650ac623..00000000 --- a/lib/VoucherifySdk/models/event_customer_reward_redemptions_created.rb +++ /dev/null @@ -1,294 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.reward_redemptions.created`. - class EventCustomerRewardRedemptionsCreated - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :reward_redemption - - attr_accessor :reward - - attr_accessor :reward_assignment - - attr_accessor :source - - attr_accessor :balance - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'reward_redemption' => :'reward_redemption', - :'reward' => :'reward', - :'reward_assignment' => :'reward_assignment', - :'source' => :'source', - :'balance' => :'balance' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'reward_redemption' => :'Object', - :'reward' => :'SimpleRedemptionRewardResult', - :'reward_assignment' => :'RewardAssignment', - :'source' => :'String', - :'balance' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRewardRedemptions' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewardRedemptionsCreated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewardRedemptionsCreated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'reward_redemption') - self.reward_redemption = attributes[:'reward_redemption'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'reward_assignment') - self.reward_assignment = attributes[:'reward_assignment'] - end - - if attributes.key?(:'source') - self.source = attributes[:'source'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - reward_redemption == o.reward_redemption && - reward == o.reward && - reward_assignment == o.reward_assignment && - source == o.source && - balance == o.balance - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, reward_redemption, reward, reward_assignment, source, balance].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_reward_redemptions_pending.rb b/lib/VoucherifySdk/models/event_customer_reward_redemptions_pending.rb deleted file mode 100644 index 31fb4a21..00000000 --- a/lib/VoucherifySdk/models/event_customer_reward_redemptions_pending.rb +++ /dev/null @@ -1,294 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.reward_redemptions.pending`. - class EventCustomerRewardRedemptionsPending - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :reward_redemption - - attr_accessor :reward - - attr_accessor :reward_assignment - - attr_accessor :source - - attr_accessor :balance - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'reward_redemption' => :'reward_redemption', - :'reward' => :'reward', - :'reward_assignment' => :'reward_assignment', - :'source' => :'source', - :'balance' => :'balance' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'reward_redemption' => :'Object', - :'reward' => :'SimpleRedemptionRewardResult', - :'reward_assignment' => :'RewardAssignment', - :'source' => :'String', - :'balance' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRewardRedemptions' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewardRedemptionsPending` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewardRedemptionsPending`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'reward_redemption') - self.reward_redemption = attributes[:'reward_redemption'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'reward_assignment') - self.reward_assignment = attributes[:'reward_assignment'] - end - - if attributes.key?(:'source') - self.source = attributes[:'source'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - reward_redemption == o.reward_redemption && - reward == o.reward && - reward_assignment == o.reward_assignment && - source == o.source && - balance == o.balance - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, reward_redemption, reward, reward_assignment, source, balance].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_reward_redemptions_rolled_back.rb b/lib/VoucherifySdk/models/event_customer_reward_redemptions_rolled_back.rb deleted file mode 100644 index 50cf1078..00000000 --- a/lib/VoucherifySdk/models/event_customer_reward_redemptions_rolled_back.rb +++ /dev/null @@ -1,294 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.reward_redemptions.rolledback`. - class EventCustomerRewardRedemptionsRolledBack - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :reward_redemption - - attr_accessor :reward - - attr_accessor :reward_assignment - - attr_accessor :source - - attr_accessor :balance - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'reward_redemption' => :'reward_redemption', - :'reward' => :'reward', - :'reward_assignment' => :'reward_assignment', - :'source' => :'source', - :'balance' => :'balance' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'reward_redemption' => :'Object', - :'reward' => :'SimpleRedemptionRewardResult', - :'reward_assignment' => :'RewardAssignment', - :'source' => :'String', - :'balance' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRewardRedemptions' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewardRedemptionsRolledBack` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewardRedemptionsRolledBack`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'reward_redemption') - self.reward_redemption = attributes[:'reward_redemption'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'reward_assignment') - self.reward_assignment = attributes[:'reward_assignment'] - end - - if attributes.key?(:'source') - self.source = attributes[:'source'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - reward_redemption == o.reward_redemption && - reward == o.reward && - reward_assignment == o.reward_assignment && - source == o.source && - balance == o.balance - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, reward_redemption, reward, reward_assignment, source, balance].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_rewarded.rb b/lib/VoucherifySdk/models/event_customer_rewarded.rb deleted file mode 100644 index c14d8fb3..00000000 --- a/lib/VoucherifySdk/models/event_customer_rewarded.rb +++ /dev/null @@ -1,296 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.rewarded`. - class EventCustomerRewarded - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :redemption - - attr_accessor :reward - - attr_accessor :referral_tier - - attr_accessor :balance - - attr_accessor :custom_event - - attr_accessor :customer_event - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'redemption' => :'redemption', - :'reward' => :'reward', - :'referral_tier' => :'referral_tier', - :'balance' => :'balance', - :'custom_event' => :'custom_event', - :'customer_event' => :'customer_event' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'redemption' => :'RedemptionInternal', - :'reward' => :'SimpleRedemptionRewardResult', - :'referral_tier' => :'SimpleReferralTier', - :'balance' => :'Integer', - :'custom_event' => :'CustomEvent', - :'customer_event' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewarded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewarded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'referral_tier') - self.referral_tier = attributes[:'referral_tier'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - - if attributes.key?(:'custom_event') - self.custom_event = attributes[:'custom_event'] - end - - if attributes.key?(:'customer_event') - self.customer_event = attributes[:'customer_event'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - redemption == o.redemption && - reward == o.reward && - referral_tier == o.referral_tier && - balance == o.balance && - custom_event == o.custom_event && - customer_event == o.customer_event - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, redemption, reward, referral_tier, balance, custom_event, customer_event].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_rewarded_loyalty_points.rb b/lib/VoucherifySdk/models/event_customer_rewarded_loyalty_points.rb deleted file mode 100644 index cc4c0f9b..00000000 --- a/lib/VoucherifySdk/models/event_customer_rewarded_loyalty_points.rb +++ /dev/null @@ -1,287 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.rewarded.loyalty_points`. - class EventCustomerRewardedLoyaltyPoints - attr_accessor :customer - - attr_accessor :holder - - attr_accessor :voucher - - attr_accessor :campaign - - attr_accessor :loyalty_tier - - attr_accessor :earning_rule - - attr_accessor :balance - - attr_accessor :order - - attr_accessor :event - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'holder' => :'holder', - :'voucher' => :'voucher', - :'campaign' => :'campaign', - :'loyalty_tier' => :'loyalty_tier', - :'earning_rule' => :'earning_rule', - :'balance' => :'balance', - :'order' => :'order', - :'event' => :'event' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'holder' => :'SimpleCustomer', - :'voucher' => :'SimpleVoucher', - :'campaign' => :'SimpleCampaign', - :'loyalty_tier' => :'LoyaltyTier', - :'earning_rule' => :'EarningRule', - :'balance' => :'Integer', - :'order' => :'OrderCalculated', - :'event' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerRewardedLoyaltyPoints` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerRewardedLoyaltyPoints`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'loyalty_tier') - self.loyalty_tier = attributes[:'loyalty_tier'] - end - - if attributes.key?(:'earning_rule') - self.earning_rule = attributes[:'earning_rule'] - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'event') - self.event = attributes[:'event'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - holder == o.holder && - voucher == o.voucher && - campaign == o.campaign && - loyalty_tier == o.loyalty_tier && - earning_rule == o.earning_rule && - balance == o.balance && - order == o.order && - event == o.event - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, holder, voucher, campaign, loyalty_tier, earning_rule, balance, order, event].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_segment_entered.rb b/lib/VoucherifySdk/models/event_customer_segment_entered.rb deleted file mode 100644 index 057edf63..00000000 --- a/lib/VoucherifySdk/models/event_customer_segment_entered.rb +++ /dev/null @@ -1,238 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.segment.entered`. - class EventCustomerSegmentEntered - attr_accessor :customer - - attr_accessor :segment - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'segment' => :'segment' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'segment' => :'SimpleSegment' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerSegmentEntered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerSegmentEntered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'segment') - self.segment = attributes[:'segment'] - else - self.segment = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @segment.nil? - invalid_properties.push('invalid value for "segment", segment cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer.nil? - return false if @segment.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - segment == o.segment - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, segment].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_segment_left.rb b/lib/VoucherifySdk/models/event_customer_segment_left.rb deleted file mode 100644 index cc7bb259..00000000 --- a/lib/VoucherifySdk/models/event_customer_segment_left.rb +++ /dev/null @@ -1,238 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.segment.left`. - class EventCustomerSegmentLeft - attr_accessor :customer - - attr_accessor :segment - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'segment' => :'segment' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'segment' => :'SimpleSegment' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerSegmentLeft` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerSegmentLeft`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'segment') - self.segment = attributes[:'segment'] - else - self.segment = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @segment.nil? - invalid_properties.push('invalid value for "segment", segment cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer.nil? - return false if @segment.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - segment == o.segment - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, segment].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_sent.rb b/lib/VoucherifySdk/models/event_customer_sent.rb deleted file mode 100644 index 9f241f9e..00000000 --- a/lib/VoucherifySdk/models/event_customer_sent.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class EventCustomerSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_shopify_failed.rb b/lib/VoucherifySdk/models/event_customer_shopify_failed.rb deleted file mode 100644 index cae45e78..00000000 --- a/lib/VoucherifySdk/models/event_customer_shopify_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.shopify.failed`. - class EventCustomerShopifyFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerShopifyFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerShopifyFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_shopify_recovered.rb b/lib/VoucherifySdk/models/event_customer_shopify_recovered.rb deleted file mode 100644 index cfc78488..00000000 --- a/lib/VoucherifySdk/models/event_customer_shopify_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.shopify.recovered`. - class EventCustomerShopifyRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerShopifyRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerShopifyRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_shopify_sent.rb b/lib/VoucherifySdk/models/event_customer_shopify_sent.rb deleted file mode 100644 index 07ec10ec..00000000 --- a/lib/VoucherifySdk/models/event_customer_shopify_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.shopify.sent`. - class EventCustomerShopifySent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerShopifySent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerShopifySent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_sms_failed.rb b/lib/VoucherifySdk/models/event_customer_sms_failed.rb deleted file mode 100644 index 3d6a792d..00000000 --- a/lib/VoucherifySdk/models/event_customer_sms_failed.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.sms.failed`. - class EventCustomerSmsFailed - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution failed in ISO 8601 format. - attr_accessor :failed_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'failed_at' => :'failed_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'failed_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerFailed' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerSmsFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerSmsFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'failed_at') - self.failed_at = attributes[:'failed_at'] - else - self.failed_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @failed_at.nil? - invalid_properties.push('invalid value for "failed_at", failed_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @failed_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - failed_at == o.failed_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, failed_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_sms_recovered.rb b/lib/VoucherifySdk/models/event_customer_sms_recovered.rb deleted file mode 100644 index 7c4ebcd9..00000000 --- a/lib/VoucherifySdk/models/event_customer_sms_recovered.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.sms.recovered`. - class EventCustomerSmsRecovered - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was recovered in ISO 8601 format. - attr_accessor :recovered_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'recovered_at' => :'recovered_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'recovered_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerRecovered' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerSmsRecovered` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerSmsRecovered`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'recovered_at') - self.recovered_at = attributes[:'recovered_at'] - else - self.recovered_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @recovered_at.nil? - invalid_properties.push('invalid value for "recovered_at", recovered_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @recovered_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - recovered_at == o.recovered_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, recovered_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_sms_sent.rb b/lib/VoucherifySdk/models/event_customer_sms_sent.rb deleted file mode 100644 index 15a28f1d..00000000 --- a/lib/VoucherifySdk/models/event_customer_sms_sent.rb +++ /dev/null @@ -1,248 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.sms.sent`. - class EventCustomerSmsSent - attr_accessor :customer - - attr_accessor :distribution - - # Timestamp representing the date and time when the distribution was sent in ISO 8601 format. - attr_accessor :sent_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'distribution' => :'distribution', - :'sent_at' => :'sent_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'distribution' => :'Object', - :'sent_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EventCustomerSent' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerSmsSent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerSmsSent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'distribution') - self.distribution = attributes[:'distribution'] - end - - if attributes.key?(:'sent_at') - self.sent_at = attributes[:'sent_at'] - else - self.sent_at = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @sent_at.nil? - invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @sent_at.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - distribution == o.distribution && - sent_at == o.sent_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, distribution, sent_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_updated.rb b/lib/VoucherifySdk/models/event_customer_updated.rb deleted file mode 100644 index a8ce6106..00000000 --- a/lib/VoucherifySdk/models/event_customer_updated.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.updated`. - class EventCustomerUpdated - attr_accessor :customer - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'CustomerWithSummaryLoyaltyReferrals' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerUpdated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerUpdated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_validation_failed.rb b/lib/VoucherifySdk/models/event_customer_validation_failed.rb deleted file mode 100644 index 4f448b01..00000000 --- a/lib/VoucherifySdk/models/event_customer_validation_failed.rb +++ /dev/null @@ -1,224 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.validation.failed`. - class EventCustomerValidationFailed - attr_accessor :customer - - attr_accessor :validation - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'validation' => :'validation' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'validation' => :'ValidationEntity' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerValidationFailed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerValidationFailed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'validation') - self.validation = attributes[:'validation'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - validation == o.validation - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, validation].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_validation_succeeded.rb b/lib/VoucherifySdk/models/event_customer_validation_succeeded.rb deleted file mode 100644 index 2c6b44c1..00000000 --- a/lib/VoucherifySdk/models/event_customer_validation_succeeded.rb +++ /dev/null @@ -1,224 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.validation.succeeded`. - class EventCustomerValidationSucceeded - attr_accessor :customer - - attr_accessor :validation - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'validation' => :'validation' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'validation' => :'ValidationEntity' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerValidationSucceeded` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerValidationSucceeded`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'validation') - self.validation = attributes[:'validation'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - validation == o.validation - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, validation].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_voucher_deleted.rb b/lib/VoucherifySdk/models/event_customer_voucher_deleted.rb deleted file mode 100644 index d9734afb..00000000 --- a/lib/VoucherifySdk/models/event_customer_voucher_deleted.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.voucher.deleted`. - class EventCustomerVoucherDeleted - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :voucher - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerVoucherDeleted` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerVoucherDeleted`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/event_customer_vouchers_loyalty_points_expired.rb b/lib/VoucherifySdk/models/event_customer_vouchers_loyalty_points_expired.rb deleted file mode 100644 index 8ebecb41..00000000 --- a/lib/VoucherifySdk/models/event_customer_vouchers_loyalty_points_expired.rb +++ /dev/null @@ -1,262 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Event data object schema for `customer.voucher.loyalty_card.points_expired`. - class EventCustomerVouchersLoyaltyPointsExpired - attr_accessor :customer - - attr_accessor :campaign - - attr_accessor :voucher - - attr_accessor :points - - attr_accessor :buckets - - attr_accessor :transaction - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'campaign' => :'campaign', - :'voucher' => :'voucher', - :'points' => :'points', - :'buckets' => :'buckets', - :'transaction' => :'transaction' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'campaign' => :'SimpleCampaign', - :'voucher' => :'SimpleVoucher', - :'points' => :'Integer', - :'buckets' => :'Array', - :'transaction' => :'VoucherTransaction' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventCustomerVouchersLoyaltyPointsExpired` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventCustomerVouchersLoyaltyPointsExpired`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - - if attributes.key?(:'buckets') - if (value = attributes[:'buckets']).is_a?(Array) - self.buckets = value - end - end - - if attributes.key?(:'transaction') - self.transaction = attributes[:'transaction'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - campaign == o.campaign && - voucher == o.voucher && - points == o.points && - buckets == o.buckets && - transaction == o.transaction - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, campaign, voucher, points, buckets, transaction].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/events_create_request_body.rb b/lib/VoucherifySdk/models/events_create_request_body.rb index 7667effd..26d10ef8 100644 --- a/lib/VoucherifySdk/models/events_create_request_body.rb +++ b/lib/VoucherifySdk/models/events_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/events`. + # Request body schema for **POST** `v1/events`. class EventsCreateRequestBody # Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. attr_accessor :event @@ -49,8 +49,8 @@ def self.openapi_types { :'event' => :'String', :'customer' => :'Customer', - :'referral' => :'ClientEventsCreateRequestBodyReferral', - :'loyalty' => :'ClientEventsCreateRequestBodyLoyalty', + :'referral' => :'EventsCreateRequestBodyReferral', + :'loyalty' => :'EventsCreateRequestBodyLoyalty', :'metadata' => :'Object' } end @@ -58,28 +58,23 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'event', + :'referral', + :'loyalty', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventsCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventsCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'event') self.event = attributes[:'event'] - else - self.event = nil end if attributes.key?(:'customer') @@ -106,15 +101,11 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @event.nil? - invalid_properties.push('invalid value for "event", event cannot be nil.') - end - - if @event.to_s.length > 300 + if !@event.nil? && @event.to_s.length > 300 invalid_properties.push('invalid value for "event", the character length must be smaller than or equal to 300.') end - if @event.to_s.length < 1 + if !@event.nil? && @event.to_s.length < 1 invalid_properties.push('invalid value for "event", the character length must be great than or equal to 1.') end @@ -129,31 +120,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @event.nil? - return false if @event.to_s.length > 300 - return false if @event.to_s.length < 1 + return false if !@event.nil? && @event.to_s.length > 300 + return false if !@event.nil? && @event.to_s.length < 1 return false if @customer.nil? true end - # Custom attribute writer method with validation - # @param [Object] event Value to be assigned - def event=(event) - if event.nil? - fail ArgumentError, 'event cannot be nil' - end - - if event.to_s.length > 300 - fail ArgumentError, 'invalid value for "event", the character length must be smaller than or equal to 300.' - end - - if event.to_s.length < 1 - fail ArgumentError, 'invalid value for "event", the character length must be great than or equal to 1.' - end - - @event = event - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/events_create_request_body_loyalty.rb b/lib/VoucherifySdk/models/events_create_request_body_loyalty.rb new file mode 100644 index 00000000..823a9fef --- /dev/null +++ b/lib/VoucherifySdk/models/events_create_request_body_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to. + class EventsCreateRequestBodyLoyalty + # Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. + attr_accessor :code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/events_create_request_body_referral.rb b/lib/VoucherifySdk/models/events_create_request_body_referral.rb new file mode 100644 index 00000000..cb2c501a --- /dev/null +++ b/lib/VoucherifySdk/models/events_create_request_body_referral.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. + class EventsCreateRequestBodyReferral + # A code through which a new visitor has been referred to a service. + attr_accessor :code + + # Unique ID of the referring person - it is optional and not required if the referral **code** is provided. + attr_accessor :referrer_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'referrer_id' => :'referrer_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'String', + :'referrer_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'code', + :'referrer_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + referrer_id == o.referrer_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, referrer_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/events_create_response_body.rb b/lib/VoucherifySdk/models/events_create_response_body.rb index ce800c05..88a4eecb 100644 --- a/lib/VoucherifySdk/models/events_create_response_body.rb +++ b/lib/VoucherifySdk/models/events_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/events`. + # Response body schema for **POST** `v1/events`. class EventsCreateResponseBody # The object represented is an `event`. attr_accessor :object @@ -30,6 +30,8 @@ class EventsCreateResponseBody # A `null` loyalty object. attr_accessor :loyalty + attr_accessor :metadata + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -59,7 +61,8 @@ def self.attribute_map :'type' => :'type', :'customer' => :'customer', :'referral' => :'referral', - :'loyalty' => :'loyalty' + :'loyalty' => :'loyalty', + :'metadata' => :'metadata' } end @@ -75,30 +78,27 @@ def self.openapi_types :'type' => :'String', :'customer' => :'SimpleCustomerRequiredObjectType', :'referral' => :'Object', - :'loyalty' => :'Object' + :'loyalty' => :'Object', + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'type', :'referral', - :'loyalty' + :'loyalty', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EventsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::EventsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -110,8 +110,6 @@ def initialize(attributes = {}) if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'customer') @@ -122,14 +120,14 @@ def initialize(attributes = {}) if attributes.key?(:'referral') self.referral = attributes[:'referral'] - else - self.referral = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] end end @@ -138,14 +136,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - if @customer.nil? invalid_properties.push('invalid value for "customer", customer cannot be nil.') end @@ -157,24 +147,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["event"]) return false unless object_validator.valid?(@object) - return false if @type.nil? return false if @customer.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["event"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -184,7 +162,8 @@ def ==(o) type == o.type && customer == o.customer && referral == o.referral && - loyalty == o.loyalty + loyalty == o.loyalty && + metadata == o.metadata end # @see the `==` method @@ -196,7 +175,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [object, type, customer, referral, loyalty].hash + [object, type, customer, referral, loyalty, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/export.rb b/lib/VoucherifySdk/models/export.rb index 183b4fe5..d09d6497 100644 --- a/lib/VoucherifySdk/models/export.rb +++ b/lib/VoucherifySdk/models/export.rb @@ -14,97 +14,311 @@ require 'time' module VoucherifySdk - module Export - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ExportCustomer', - :'ExportOrder', - :'ExportPointsExpiration', - :'ExportPublication', - :'ExportRedemption', - :'ExportVoucher', - :'ExportVoucherTransactions' - ] - end + class Export + # Unique export ID. + attr_accessor :id + + # The type of object being represented. This object stores information about the export. + attr_accessor :object + + # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + attr_accessor :created_at + + # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + attr_accessor :status + + # The channel through which the export was triggered. + attr_accessor :channel + + attr_accessor :result + + # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + attr_accessor :user_id + + attr_accessor :exported_object + + attr_accessor :parameters - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil + def valid?(value) + !value || allowable_values.include?(value) end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'status' => :'status', + :'channel' => :'channel', + :'result' => :'result', + :'user_id' => :'user_id', + :'exported_object' => :'exported_object', + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'channel' => :'String', + :'result' => :'ExportResult', + :'user_id' => :'String', + :'exported_object' => :'String', + :'parameters' => :'ExportParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', + :'result', + :'user_id', + :'exported_object', + :'parameters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'export' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'exported_object') + self.exported_object = attributes[:'exported_object'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["export"]) + return false unless object_validator.valid?(@object) + status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) + return false unless status_validator.valid?(@status) + exported_object_validator = EnumAttributeValidator.new('String', ["voucher", "redemption", "customer", "publication", "order", "points_expiration", "voucher_transactions"]) + return false unless exported_object_validator.valid?(@exported_object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + status == o.status && + channel == o.channel && + result == o.result && + user_id == o.user_id && + exported_object == o.exported_object && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/export_base.rb b/lib/VoucherifySdk/models/export_base.rb deleted file mode 100644 index ccae40a0..00000000 --- a/lib/VoucherifySdk/models/export_base.rb +++ /dev/null @@ -1,354 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportBase - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id' - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_base_result.rb b/lib/VoucherifySdk/models/export_base_result.rb deleted file mode 100644 index 48222ed6..00000000 --- a/lib/VoucherifySdk/models/export_base_result.rb +++ /dev/null @@ -1,223 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains the URL of the CSV file. - class ExportBaseResult - # URL of the CSV file location. It contains the token used for authorization in the Download export method. - attr_accessor :url - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'url' => :'url' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'url' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportBaseResult` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportBaseResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'url') - self.url = attributes[:'url'] - else - self.url = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @url.nil? - invalid_properties.push('invalid value for "url", url cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @url.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - url == o.url - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [url].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_customer.rb b/lib/VoucherifySdk/models/export_customer.rb deleted file mode 100644 index 684aef35..00000000 --- a/lib/VoucherifySdk/models/export_customer.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportCustomer - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportCustomerBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportCustomerBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportCustomer` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'customer' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["customer"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_customer_base.rb b/lib/VoucherifySdk/models/export_customer_base.rb deleted file mode 100644 index ae2de4dc..00000000 --- a/lib/VoucherifySdk/models/export_customer_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportCustomerBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'ExportCustomerBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportCustomerBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportCustomerBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'customer' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["customer"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_customer_base_parameters.rb b/lib/VoucherifySdk/models/export_customer_base_parameters.rb deleted file mode 100644 index 3da87d46..00000000 --- a/lib/VoucherifySdk/models/export_customer_base_parameters.rb +++ /dev/null @@ -1,259 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # List of available fields and filters that can be exported with an order along with the sorting order of the returned data. - class ExportCustomerBaseParameters - attr_accessor :order - - # Array of strings containing the data in the export. These fields define the headers in the CSV file. - attr_accessor :fields - - # Allowed additional properties must start with \"metadata.\" or \"address.\" or \"summary.\" or \"loyalty.\" or \"loyalty_tier.\" or \"loyalty_points.\" or \"system_metadata.\" - attr_accessor :filters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'order' => :'order', - :'fields' => :'fields', - :'filters' => :'filters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'order' => :'ExportCustomerOrder', - :'fields' => :'Array', - :'filters' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportCustomerBaseParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportCustomerBaseParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'fields') - if (value = attributes[:'fields']).is_a?(Array) - self.fields = value - end - end - - if attributes.key?(:'filters') - self.filters = attributes[:'filters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - order == o.order && - fields == o.fields && - filters == o.filters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [order, fields, filters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_customer_fields.rb b/lib/VoucherifySdk/models/export_customer_fields.rb deleted file mode 100644 index 35fac2e8..00000000 --- a/lib/VoucherifySdk/models/export_customer_fields.rb +++ /dev/null @@ -1,68 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportCustomerFields - NAME = "name".freeze - ID = "id".freeze - DESCRIPTION = "description".freeze - EMAIL = "email".freeze - SOURCE_ID = "source_id".freeze - CREATED_AT = "created_at".freeze - ADDRESS_CITY = "address_city".freeze - ADDRESS_STATE = "address_state".freeze - ADDRESS_LINE_1 = "address_line_1".freeze - ADDRESS_LINE_2 = "address_line_2".freeze - ADDRESS_COUNTRY = "address_country".freeze - ADDRESS_POSTAL_CODE = "address_postal_code".freeze - REDEMPTIONS_TOTAL_REDEEMED = "redemptions_total_redeemed".freeze - REDEMPTIONS_TOTAL_FAILED = "redemptions_total_failed".freeze - REDEMPTIONS_TOTAL_SUCCEEDED = "redemptions_total_succeeded".freeze - REDEMPTIONS_TOTAL_ROLLED_BACK = "redemptions_total_rolled_back".freeze - REDEMPTIONS_TOTAL_ROLLBACK_FAILED = "redemptions_total_rollback_failed".freeze - REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED = "redemptions_total_rollback_succeeded".freeze - ORDERS_TOTAL_AMOUNT = "orders_total_amount".freeze - ORDERS_TOTAL_COUNT = "orders_total_count".freeze - ORDERS_AVERAGE_AMOUNT = "orders_average_amount".freeze - ORDERS_LAST_ORDER_AMOUNT = "orders_last_order_amount".freeze - ORDERS_LAST_ORDER_DATE = "orders_last_order_date".freeze - LOYALTY_POINTS = "loyalty_points".freeze - LOYALTY_REFERRED_CUSTOMERS = "loyalty_referred_customers".freeze - UPDATED_AT = "updated_at".freeze - PHONE = "phone".freeze - BIRTHDAY = "birthday".freeze - METADATA = "metadata".freeze - BIRTHDATE = "birthdate".freeze - - def self.all_vars - @all_vars ||= [NAME, ID, DESCRIPTION, EMAIL, SOURCE_ID, CREATED_AT, ADDRESS_CITY, ADDRESS_STATE, ADDRESS_LINE_1, ADDRESS_LINE_2, ADDRESS_COUNTRY, ADDRESS_POSTAL_CODE, REDEMPTIONS_TOTAL_REDEEMED, REDEMPTIONS_TOTAL_FAILED, REDEMPTIONS_TOTAL_SUCCEEDED, REDEMPTIONS_TOTAL_ROLLED_BACK, REDEMPTIONS_TOTAL_ROLLBACK_FAILED, REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED, ORDERS_TOTAL_AMOUNT, ORDERS_TOTAL_COUNT, ORDERS_AVERAGE_AMOUNT, ORDERS_LAST_ORDER_AMOUNT, ORDERS_LAST_ORDER_DATE, LOYALTY_POINTS, LOYALTY_REFERRED_CUSTOMERS, UPDATED_AT, PHONE, BIRTHDAY, METADATA, BIRTHDATE].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportCustomerFields.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportCustomerFields" - end - end -end diff --git a/lib/VoucherifySdk/models/export_customer_order.rb b/lib/VoucherifySdk/models/export_customer_order.rb deleted file mode 100644 index acab4777..00000000 --- a/lib/VoucherifySdk/models/export_customer_order.rb +++ /dev/null @@ -1,50 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportCustomerOrder - NAME = "-name".freeze - NAME2 = "name".freeze - ID = "-id".freeze - ID2 = "id".freeze - EMAIL = "-email".freeze - EMAIL2 = "email".freeze - SOURCE_ID = "-source_id".freeze - SOURCE_ID2 = "source_id".freeze - CREATED_AT = "-created_at".freeze - CREATED_AT2 = "created_at".freeze - UPDATED_AT = "-updated_at".freeze - UPDATED_AT2 = "updated_at".freeze - - def self.all_vars - @all_vars ||= [NAME, NAME2, ID, ID2, EMAIL, EMAIL2, SOURCE_ID, SOURCE_ID2, CREATED_AT, CREATED_AT2, UPDATED_AT, UPDATED_AT2].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportCustomerOrder.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportCustomerOrder" - end - end -end diff --git a/lib/VoucherifySdk/models/export_customer_scheduled.rb b/lib/VoucherifySdk/models/export_customer_scheduled.rb deleted file mode 100644 index 2e46f94b..00000000 --- a/lib/VoucherifySdk/models/export_customer_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportCustomerScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportCustomerBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportCustomerBase', - :'ExportScheduledBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportCustomerScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportCustomerScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'customer' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["customer"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_order.rb b/lib/VoucherifySdk/models/export_order.rb deleted file mode 100644 index 8ddbb822..00000000 --- a/lib/VoucherifySdk/models/export_order.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportOrder - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'OrdersExportCreateRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportOrderBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportOrder` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'order' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["order"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_order_base.rb b/lib/VoucherifySdk/models/export_order_base.rb deleted file mode 100644 index 7042aa2e..00000000 --- a/lib/VoucherifySdk/models/export_order_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportOrderBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'OrdersExportCreateRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportOrderBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportOrderBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'order' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["order"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_order_scheduled.rb b/lib/VoucherifySdk/models/export_order_scheduled.rb deleted file mode 100644 index 29f6b632..00000000 --- a/lib/VoucherifySdk/models/export_order_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportOrderScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'OrdersExportCreateRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportOrderBase', - :'ExportScheduledBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportOrderScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportOrderScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'order' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["order"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_parameters.rb b/lib/VoucherifySdk/models/export_parameters.rb new file mode 100644 index 00000000..970835bc --- /dev/null +++ b/lib/VoucherifySdk/models/export_parameters.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportParameters + attr_accessor :order + + # Array of strings containing the data in the export. These fields define the headers in the CSV file. + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'String', + :'fields' => :'Array', + :'filters' => :'ExportParametersFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order', + :'fields', + :'filters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + order_validator = EnumAttributeValidator.new('String', ["-created_at", "created_at", "-updated_at", "updated_at", "-code", "code", "-id", "id", "-voucher_code", "voucher_code", "-tracking_id", "tracking_id", "-customer_id", "customer_id"]) + return false unless order_validator.valid?(@order) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/export_parameters_filters.rb b/lib/VoucherifySdk/models/export_parameters_filters.rb new file mode 100644 index 00000000..50f0c72d --- /dev/null +++ b/lib/VoucherifySdk/models/export_parameters_filters.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportParametersFilters + attr_accessor :junction + + attr_accessor :campaign_id + + attr_accessor :voucher_id + + attr_accessor :created_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'campaign_id' => :'campaign_id', + :'voucher_id' => :'voucher_id', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'campaign_id' => :'FieldConditions', + :'voucher_id' => :'FieldConditions', + :'created_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'voucher_id') + self.voucher_id = attributes[:'voucher_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + campaign_id == o.campaign_id && + voucher_id == o.voucher_id && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, campaign_id, voucher_id, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/export_points_expiration.rb b/lib/VoucherifySdk/models/export_points_expiration.rb deleted file mode 100644 index 2e0f8146..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPointsExpiration - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportPointsExpirationBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportPointsExpirationBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPointsExpiration` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPointsExpiration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'points_expiration' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["points_expiration"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["points_expiration"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_points_expiration_base.rb b/lib/VoucherifySdk/models/export_points_expiration_base.rb deleted file mode 100644 index f668670b..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPointsExpirationBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'ExportPointsExpirationBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPointsExpirationBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPointsExpirationBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'points_expiration' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["points_expiration"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["points_expiration"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_points_expiration_base_parameters.rb b/lib/VoucherifySdk/models/export_points_expiration_base_parameters.rb deleted file mode 100644 index 308513a3..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration_base_parameters.rb +++ /dev/null @@ -1,258 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # List of available fields and filters that can be exported with an order along with the sorting order of the returned data. - class ExportPointsExpirationBaseParameters - attr_accessor :order - - # Array of strings containing the data in the export. These fields define the headers in the CSV file. - attr_accessor :fields - - attr_accessor :filters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'order' => :'order', - :'fields' => :'fields', - :'filters' => :'filters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'order' => :'ExportPointsExpirationOrder', - :'fields' => :'Array', - :'filters' => :'ExportPointsExpirationFilters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPointsExpirationBaseParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPointsExpirationBaseParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'fields') - if (value = attributes[:'fields']).is_a?(Array) - self.fields = value - end - end - - if attributes.key?(:'filters') - self.filters = attributes[:'filters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - order == o.order && - fields == o.fields && - filters == o.filters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [order, fields, filters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_points_expiration_fields.rb b/lib/VoucherifySdk/models/export_points_expiration_fields.rb deleted file mode 100644 index 7bb68f70..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration_fields.rb +++ /dev/null @@ -1,44 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPointsExpirationFields - ID = "id".freeze - CAMPAIGN_ID = "campaign_id".freeze - VOUCHER_ID = "voucher_id".freeze - POINTS = "points".freeze - STATUS = "status".freeze - EXPIRES_AT = "expires_at".freeze - - def self.all_vars - @all_vars ||= [ID, CAMPAIGN_ID, VOUCHER_ID, POINTS, STATUS, EXPIRES_AT].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportPointsExpirationFields.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportPointsExpirationFields" - end - end -end diff --git a/lib/VoucherifySdk/models/export_points_expiration_filters.rb b/lib/VoucherifySdk/models/export_points_expiration_filters.rb deleted file mode 100644 index 69fe0669..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration_filters.rb +++ /dev/null @@ -1,254 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPointsExpirationFilters - attr_accessor :junction - - attr_accessor :campaign_id - - attr_accessor :voucher_id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'junction' => :'junction', - :'campaign_id' => :'campaign_id', - :'voucher_id' => :'voucher_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'junction' => :'Junction', - :'campaign_id' => :'FieldConditions', - :'voucher_id' => :'FieldConditions' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPointsExpirationFilters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPointsExpirationFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'junction') - self.junction = attributes[:'junction'] - end - - if attributes.key?(:'campaign_id') - self.campaign_id = attributes[:'campaign_id'] - end - - if attributes.key?(:'voucher_id') - self.voucher_id = attributes[:'voucher_id'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - junction == o.junction && - campaign_id == o.campaign_id && - voucher_id == o.voucher_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [junction, campaign_id, voucher_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_points_expiration_order.rb b/lib/VoucherifySdk/models/export_points_expiration_order.rb deleted file mode 100644 index 7cfe07db..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration_order.rb +++ /dev/null @@ -1,40 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPointsExpirationOrder - EXPIRES_AT = "-expires_at".freeze - EXPIRES_AT2 = "expires_at".freeze - - def self.all_vars - @all_vars ||= [EXPIRES_AT, EXPIRES_AT2].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportPointsExpirationOrder.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportPointsExpirationOrder" - end - end -end diff --git a/lib/VoucherifySdk/models/export_points_expiration_scheduled.rb b/lib/VoucherifySdk/models/export_points_expiration_scheduled.rb deleted file mode 100644 index a0e59f93..00000000 --- a/lib/VoucherifySdk/models/export_points_expiration_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPointsExpirationScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportPointsExpirationBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportPointsExpirationBase', - :'ExportScheduledBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPointsExpirationScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPointsExpirationScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'points_expiration' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["points_expiration"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["points_expiration"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_publication.rb b/lib/VoucherifySdk/models/export_publication.rb deleted file mode 100644 index 06d46e78..00000000 --- a/lib/VoucherifySdk/models/export_publication.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPublication - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportPublicationBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportPublicationBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPublication` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPublication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'publication' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_publication_base.rb b/lib/VoucherifySdk/models/export_publication_base.rb deleted file mode 100644 index 8f4d900e..00000000 --- a/lib/VoucherifySdk/models/export_publication_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPublicationBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'ExportPublicationBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPublicationBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPublicationBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'publication' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_publication_base_parameters.rb b/lib/VoucherifySdk/models/export_publication_base_parameters.rb deleted file mode 100644 index 3168ff1f..00000000 --- a/lib/VoucherifySdk/models/export_publication_base_parameters.rb +++ /dev/null @@ -1,259 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # List of available fields and filters that can be exported with an order along with the sorting order of the returned data. - class ExportPublicationBaseParameters - attr_accessor :order - - # Array of strings containing the data in the export. These fields define the headers in the CSV file. - attr_accessor :fields - - # Allowed additional properties must start with \"metadata.\" - attr_accessor :filters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'order' => :'order', - :'fields' => :'fields', - :'filters' => :'filters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'order' => :'ExportPublicationOrder', - :'fields' => :'Array', - :'filters' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPublicationBaseParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPublicationBaseParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'fields') - if (value = attributes[:'fields']).is_a?(Array) - self.fields = value - end - end - - if attributes.key?(:'filters') - self.filters = attributes[:'filters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - order == o.order && - fields == o.fields && - filters == o.filters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [order, fields, filters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_publication_fields.rb b/lib/VoucherifySdk/models/export_publication_fields.rb deleted file mode 100644 index 487554b1..00000000 --- a/lib/VoucherifySdk/models/export_publication_fields.rb +++ /dev/null @@ -1,46 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPublicationFields - VOUCHER_CODE = "voucher_code".freeze - CUSTOMER_ID = "customer_id".freeze - CUSTOMER_SOURCE_ID = "customer_source_id".freeze - DATE = "date".freeze - CHANNEL = "channel".freeze - CAMPAIGN = "campaign".freeze - IS_WINNER = "is_winner".freeze - METADATA = "metadata".freeze - - def self.all_vars - @all_vars ||= [VOUCHER_CODE, CUSTOMER_ID, CUSTOMER_SOURCE_ID, DATE, CHANNEL, CAMPAIGN, IS_WINNER, METADATA].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportPublicationFields.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportPublicationFields" - end - end -end diff --git a/lib/VoucherifySdk/models/export_publication_order.rb b/lib/VoucherifySdk/models/export_publication_order.rb deleted file mode 100644 index b0629f06..00000000 --- a/lib/VoucherifySdk/models/export_publication_order.rb +++ /dev/null @@ -1,50 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPublicationOrder - ID = "-id".freeze - ID2 = "id".freeze - VOUCHER_CODE = "-voucher_code".freeze - VOUCHER_CODE2 = "voucher_code".freeze - TRACKING_ID = "-tracking_id".freeze - TRACKING_ID2 = "tracking_id".freeze - CUSTOMER_ID = "-customer_id".freeze - CUSTOMER_ID2 = "customer_id".freeze - CREATED_AT = "-created_at".freeze - CREATED_AT2 = "created_at".freeze - CHANNEL = "-channel".freeze - CHANNEL2 = "channel".freeze - - def self.all_vars - @all_vars ||= [ID, ID2, VOUCHER_CODE, VOUCHER_CODE2, TRACKING_ID, TRACKING_ID2, CUSTOMER_ID, CUSTOMER_ID2, CREATED_AT, CREATED_AT2, CHANNEL, CHANNEL2].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportPublicationOrder.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportPublicationOrder" - end - end -end diff --git a/lib/VoucherifySdk/models/export_publication_scheduled.rb b/lib/VoucherifySdk/models/export_publication_scheduled.rb deleted file mode 100644 index 97a7fe6e..00000000 --- a/lib/VoucherifySdk/models/export_publication_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportPublicationScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportPublicationBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportPublicationBase', - :'ExportScheduledBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportPublicationScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportPublicationScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'publication' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_redemption.rb b/lib/VoucherifySdk/models/export_redemption.rb deleted file mode 100644 index 972d8841..00000000 --- a/lib/VoucherifySdk/models/export_redemption.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportRedemption - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportRedemptionBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportRedemptionBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportRedemption` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'redemption' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["redemption"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["redemption"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_redemption_base.rb b/lib/VoucherifySdk/models/export_redemption_base.rb deleted file mode 100644 index 8710cb0c..00000000 --- a/lib/VoucherifySdk/models/export_redemption_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportRedemptionBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'ExportRedemptionBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportRedemptionBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportRedemptionBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'redemption' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["redemption"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["redemption"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_redemption_base_parameters.rb b/lib/VoucherifySdk/models/export_redemption_base_parameters.rb deleted file mode 100644 index 649ee38b..00000000 --- a/lib/VoucherifySdk/models/export_redemption_base_parameters.rb +++ /dev/null @@ -1,259 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # List of available fields and filters that can be exported with an order along with the sorting order of the returned data. - class ExportRedemptionBaseParameters - attr_accessor :order - - # Array of strings containing the data in the export. These fields define the headers in the CSV file. - attr_accessor :fields - - # Allowed additional properties must start with \"metadata.\" - attr_accessor :filters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'order' => :'order', - :'fields' => :'fields', - :'filters' => :'filters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'order' => :'ExportRedemptionOrder', - :'fields' => :'Array', - :'filters' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportRedemptionBaseParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportRedemptionBaseParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'fields') - if (value = attributes[:'fields']).is_a?(Array) - self.fields = value - end - end - - if attributes.key?(:'filters') - self.filters = attributes[:'filters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - order == o.order && - fields == o.fields && - filters == o.filters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [order, fields, filters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_redemption_fields.rb b/lib/VoucherifySdk/models/export_redemption_fields.rb deleted file mode 100644 index 8a3f0576..00000000 --- a/lib/VoucherifySdk/models/export_redemption_fields.rb +++ /dev/null @@ -1,55 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportRedemptionFields - ID = "id".freeze - OBJECT = "object".freeze - DATE = "date".freeze - VOUCHER_CODE = "voucher_code".freeze - CAMPAIGN = "campaign".freeze - PROMOTION_TIER_ID = "promotion_tier_id".freeze - CUSTOMER_ID = "customer_id".freeze - CUSTOMER_SOURCE_ID = "customer_source_id".freeze - CUSTOMER_NAME = "customer_name".freeze - TRACKING_ID = "tracking_id".freeze - ORDER_AMOUNT = "order_amount".freeze - GIFT_AMOUNT = "gift_amount".freeze - LOYALTY_POINTS = "loyalty_points".freeze - RESULT = "result".freeze - FAILURE_CODE = "failure_code".freeze - FAILURE_MESSAGE = "failure_message".freeze - METADATA = "metadata".freeze - - def self.all_vars - @all_vars ||= [ID, OBJECT, DATE, VOUCHER_CODE, CAMPAIGN, PROMOTION_TIER_ID, CUSTOMER_ID, CUSTOMER_SOURCE_ID, CUSTOMER_NAME, TRACKING_ID, ORDER_AMOUNT, GIFT_AMOUNT, LOYALTY_POINTS, RESULT, FAILURE_CODE, FAILURE_MESSAGE, METADATA].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportRedemptionFields.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportRedemptionFields" - end - end -end diff --git a/lib/VoucherifySdk/models/export_redemption_order.rb b/lib/VoucherifySdk/models/export_redemption_order.rb deleted file mode 100644 index 9a821731..00000000 --- a/lib/VoucherifySdk/models/export_redemption_order.rb +++ /dev/null @@ -1,48 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportRedemptionOrder - ID = "-id".freeze - ID2 = "id".freeze - VOUCHER_CODE = "-voucher_code".freeze - VOUCHER_CODE2 = "voucher_code".freeze - TRACKING_ID = "-tracking_id".freeze - TRACKING_ID2 = "tracking_id".freeze - CUSTOMER_ID = "-customer_id".freeze - CUSTOMER_ID2 = "customer_id".freeze - CREATED_AT = "-created_at".freeze - CREATED_AT2 = "created_at".freeze - - def self.all_vars - @all_vars ||= [ID, ID2, VOUCHER_CODE, VOUCHER_CODE2, TRACKING_ID, TRACKING_ID2, CUSTOMER_ID, CUSTOMER_ID2, CREATED_AT, CREATED_AT2].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportRedemptionOrder.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportRedemptionOrder" - end - end -end diff --git a/lib/VoucherifySdk/models/export_redemption_scheduled.rb b/lib/VoucherifySdk/models/export_redemption_scheduled.rb deleted file mode 100644 index 64beb39f..00000000 --- a/lib/VoucherifySdk/models/export_redemption_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportRedemptionScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportRedemptionBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportRedemptionBase', - :'ExportScheduledBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportRedemptionScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportRedemptionScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'redemption' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["redemption"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["redemption"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_result.rb b/lib/VoucherifySdk/models/export_result.rb new file mode 100644 index 00000000..4c0709c3 --- /dev/null +++ b/lib/VoucherifySdk/models/export_result.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportResult + # URL of the CSV file location. It contains the token used for authorization in the Download export method. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/export_scheduled_base.rb b/lib/VoucherifySdk/models/export_scheduled_base.rb deleted file mode 100644 index 28af3beb..00000000 --- a/lib/VoucherifySdk/models/export_scheduled_base.rb +++ /dev/null @@ -1,359 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportScheduledBase - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportScheduledBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportScheduledBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher.rb b/lib/VoucherifySdk/models/export_voucher.rb deleted file mode 100644 index 9bf00319..00000000 --- a/lib/VoucherifySdk/models/export_voucher.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucher - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportVoucherBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportVoucherBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher_base.rb b/lib/VoucherifySdk/models/export_voucher_base.rb deleted file mode 100644 index cc5649b7..00000000 --- a/lib/VoucherifySdk/models/export_voucher_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'ExportVoucherBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher_base_parameters.rb b/lib/VoucherifySdk/models/export_voucher_base_parameters.rb deleted file mode 100644 index 2968ce8e..00000000 --- a/lib/VoucherifySdk/models/export_voucher_base_parameters.rb +++ /dev/null @@ -1,258 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherBaseParameters - attr_accessor :order - - # Array of strings containing the data in the export. These fields define the headers in the CSV file. - attr_accessor :fields - - # Allowed additional properties must start with \"metadata.\" or \"redemption.\" - attr_accessor :filters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'order' => :'order', - :'fields' => :'fields', - :'filters' => :'filters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'order' => :'ExportVoucherOrder', - :'fields' => :'Array', - :'filters' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherBaseParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherBaseParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'fields') - if (value = attributes[:'fields']).is_a?(Array) - self.fields = value - end - end - - if attributes.key?(:'filters') - self.filters = attributes[:'filters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - order == o.order && - fields == o.fields && - filters == o.filters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [order, fields, filters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher_fields.rb b/lib/VoucherifySdk/models/export_voucher_fields.rb deleted file mode 100644 index 65a644e4..00000000 --- a/lib/VoucherifySdk/models/export_voucher_fields.rb +++ /dev/null @@ -1,68 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherFields - CODE = "code".freeze - VOUCHER_TYPE = "voucher_type".freeze - VALUE = "value".freeze - DISCOUNT_TYPE = "discount_type".freeze - CAMPAIGN = "campaign".freeze - CATEGORY = "category".freeze - START_DATE = "start_date".freeze - EXPIRATION_DATE = "expiration_date".freeze - GIFT_BALANCE = "gift_balance".freeze - LOYALTY_BALANCE = "loyalty_balance".freeze - REDEMPTION_QUANTITY = "redemption_quantity".freeze - REDEMPTION_COUNT = "redemption_count".freeze - ACTIVE = "active".freeze - QR_CODE = "qr_code".freeze - BAR_CODE = "bar_code".freeze - METADATA = "metadata".freeze - ID = "id".freeze - IS_REFERRAL_CODE = "is_referral_code".freeze - CREATED_AT = "created_at".freeze - UPDATED_AT = "updated_at".freeze - VALIDITY_TIMEFRAME_INTERVAL = "validity_timeframe_interval".freeze - VALIDITY_TIMEFRAME_DURATION = "validity_timeframe_duration".freeze - VALIDITY_DAY_OF_WEEK = "validity_day_of_week".freeze - DISCOUNT_AMOUNT_LIMIT = "discount_amount_limit".freeze - CAMPAIGN_ID = "campaign_id".freeze - ADDITIONAL_INFO = "additional_info".freeze - CUSTOMER_ID = "customer_id".freeze - DISCOUNT_UNIT_TYPE = "discount_unit_type".freeze - DISCOUNT_UNIT_EFFECT = "discount_unit_effect".freeze - CUSTOMER_SOURCE_ID = "customer_source_id".freeze - - def self.all_vars - @all_vars ||= [CODE, VOUCHER_TYPE, VALUE, DISCOUNT_TYPE, CAMPAIGN, CATEGORY, START_DATE, EXPIRATION_DATE, GIFT_BALANCE, LOYALTY_BALANCE, REDEMPTION_QUANTITY, REDEMPTION_COUNT, ACTIVE, QR_CODE, BAR_CODE, METADATA, ID, IS_REFERRAL_CODE, CREATED_AT, UPDATED_AT, VALIDITY_TIMEFRAME_INTERVAL, VALIDITY_TIMEFRAME_DURATION, VALIDITY_DAY_OF_WEEK, DISCOUNT_AMOUNT_LIMIT, CAMPAIGN_ID, ADDITIONAL_INFO, CUSTOMER_ID, DISCOUNT_UNIT_TYPE, DISCOUNT_UNIT_EFFECT, CUSTOMER_SOURCE_ID].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportVoucherFields.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportVoucherFields" - end - end -end diff --git a/lib/VoucherifySdk/models/export_voucher_order.rb b/lib/VoucherifySdk/models/export_voucher_order.rb deleted file mode 100644 index 322cd78f..00000000 --- a/lib/VoucherifySdk/models/export_voucher_order.rb +++ /dev/null @@ -1,44 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherOrder - CREATED_AT = "-created_at".freeze - CREATED_AT2 = "created_at".freeze - UPDATED_AT = "-updated_at".freeze - UPDATED_AT2 = "updated_at".freeze - CODE = "-code".freeze - CODE2 = "code".freeze - - def self.all_vars - @all_vars ||= [CREATED_AT, CREATED_AT2, UPDATED_AT, UPDATED_AT2, CODE, CODE2].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if ExportVoucherOrder.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #ExportVoucherOrder" - end - end -end diff --git a/lib/VoucherifySdk/models/export_voucher_scheduled.rb b/lib/VoucherifySdk/models/export_voucher_scheduled.rb deleted file mode 100644 index ddcebc54..00000000 --- a/lib/VoucherifySdk/models/export_voucher_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'ExportVoucherBaseParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportScheduledBase', - :'ExportVoucherBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher_transactions.rb b/lib/VoucherifySdk/models/export_voucher_transactions.rb deleted file mode 100644 index c9187d7b..00000000 --- a/lib/VoucherifySdk/models/export_voucher_transactions.rb +++ /dev/null @@ -1,400 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherTransactions - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'ExportBaseResult', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'LoyaltiesMembersTransactionsExportCreateRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportBase', - :'ExportVoucherTransactionsBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherTransactions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherTransactions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher_transactions' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher_transactions_base.rb b/lib/VoucherifySdk/models/export_voucher_transactions_base.rb deleted file mode 100644 index e8542f47..00000000 --- a/lib/VoucherifySdk/models/export_voucher_transactions_base.rb +++ /dev/null @@ -1,265 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherTransactionsBase - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exported_object' => :'String', - :'parameters' => :'LoyaltiesMembersTransactionsExportCreateRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherTransactionsBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherTransactionsBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher_transactions' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/export_voucher_transactions_filters.rb b/lib/VoucherifySdk/models/export_voucher_transactions_filters.rb index 830816fe..0634f38f 100644 --- a/lib/VoucherifySdk/models/export_voucher_transactions_filters.rb +++ b/lib/VoucherifySdk/models/export_voucher_transactions_filters.rb @@ -79,15 +79,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherTransactionsFilters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherTransactionsFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/export_voucher_transactions_scheduled.rb b/lib/VoucherifySdk/models/export_voucher_transactions_scheduled.rb deleted file mode 100644 index 9f0d5479..00000000 --- a/lib/VoucherifySdk/models/export_voucher_transactions_scheduled.rb +++ /dev/null @@ -1,405 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ExportVoucherTransactionsScheduled - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the export. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # Contains the URL of the CSV file. - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. - attr_accessor :user_id - - # The type of object to be exported. - attr_accessor :exported_object - - attr_accessor :parameters - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'result' => :'result', - :'user_id' => :'user_id', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'result' => :'Object', - :'user_id' => :'String', - :'exported_object' => :'String', - :'parameters' => :'LoyaltiesMembersTransactionsExportCreateRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportScheduledBase', - :'ExportVoucherTransactionsBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportVoucherTransactionsScheduled` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportVoucherTransactionsScheduled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher_transactions' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - return false unless exported_object_validator.valid?(@exported_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - result == o.result && - user_id == o.user_id && - exported_object == o.exported_object && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/exports_create_request_body.rb b/lib/VoucherifySdk/models/exports_create_request_body.rb index 8cefd116..4851871a 100644 --- a/lib/VoucherifySdk/models/exports_create_request_body.rb +++ b/lib/VoucherifySdk/models/exports_create_request_body.rb @@ -14,98 +14,229 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/exports`. - module ExportsCreateRequestBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ExportCustomerBase', - :'ExportOrderBase', - :'ExportPointsExpirationBase', - :'ExportPublicationBase', - :'ExportRedemptionBase', - :'ExportVoucherBase', - :'ExportVoucherTransactionsBase' - ] - end + class ExportsCreateRequestBody + attr_accessor :exported_object + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil + def valid?(value) + !value || allowable_values.include?(value) end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'exported_object' => :'exported_object', + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'exported_object' => :'String', + :'parameters' => :'ExportsCreateRequestBodyParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'exported_object', + :'parameters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'exported_object') + self.exported_object = attributes[:'exported_object'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + exported_object_validator = EnumAttributeValidator.new('String', ["voucher", "redemption", "customer", "publication", "order", "points_expiration", "voucher_transactions"]) + return false unless exported_object_validator.valid?(@exported_object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + exported_object == o.exported_object && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [exported_object, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/exports_create_request_body_parameters.rb b/lib/VoucherifySdk/models/exports_create_request_body_parameters.rb new file mode 100644 index 00000000..56dab875 --- /dev/null +++ b/lib/VoucherifySdk/models/exports_create_request_body_parameters.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsCreateRequestBodyParameters + attr_accessor :order + + # Array of strings containing the data in the export. These fields define the headers in the CSV file. + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'String', + :'fields' => :'Array', + :'filters' => :'ExportsCreateRequestBodyParametersFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order', + :'fields', + :'filters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + order_validator = EnumAttributeValidator.new('String', ["-created_at", "created_at", "-updated_at", "updated_at", "-code", "code", "-id", "id", "-voucher_code", "voucher_code", "-tracking_id", "tracking_id", "-customer_id", "customer_id"]) + return false unless order_validator.valid?(@order) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_create_request_body_parameters_filters.rb b/lib/VoucherifySdk/models/exports_create_request_body_parameters_filters.rb new file mode 100644 index 00000000..e9e60091 --- /dev/null +++ b/lib/VoucherifySdk/models/exports_create_request_body_parameters_filters.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsCreateRequestBodyParametersFilters + attr_accessor :junction + + attr_accessor :campaign_id + + attr_accessor :voucher_id + + attr_accessor :created_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'campaign_id' => :'campaign_id', + :'voucher_id' => :'voucher_id', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'campaign_id' => :'FieldConditions', + :'voucher_id' => :'FieldConditions', + :'created_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'voucher_id') + self.voucher_id = attributes[:'voucher_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + campaign_id == o.campaign_id && + voucher_id == o.voucher_id && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, campaign_id, voucher_id, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_create_response_body.rb b/lib/VoucherifySdk/models/exports_create_response_body.rb index a98bc552..51fdfc17 100644 --- a/lib/VoucherifySdk/models/exports_create_response_body.rb +++ b/lib/VoucherifySdk/models/exports_create_response_body.rb @@ -14,98 +14,314 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/exports`. - module ExportsCreateResponseBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ExportCustomerScheduled', - :'ExportOrderScheduled', - :'ExportPointsExpirationScheduled', - :'ExportPublicationScheduled', - :'ExportRedemptionScheduled', - :'ExportVoucherScheduled', - :'ExportVoucherTransactionsScheduled' - ] - end + class ExportsCreateResponseBody + # Unique export ID. + attr_accessor :id + + # The type of object being represented. This object stores information about the export. + attr_accessor :object + + # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + attr_accessor :created_at + + # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + attr_accessor :status + + # The channel through which the export was triggered. + attr_accessor :channel + + # Contains the URL of the CSV file. + attr_accessor :result + + # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + attr_accessor :user_id + + attr_accessor :exported_object + + attr_accessor :parameters - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil + def valid?(value) + !value || allowable_values.include?(value) end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'status' => :'status', + :'channel' => :'channel', + :'result' => :'result', + :'user_id' => :'user_id', + :'exported_object' => :'exported_object', + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'channel' => :'String', + :'result' => :'Object', + :'user_id' => :'String', + :'exported_object' => :'String', + :'parameters' => :'ExportsCreateResponseBodyParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', + :'result', + :'user_id', + :'exported_object', + :'parameters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'export' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 'SCHEDULED' + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'exported_object') + self.exported_object = attributes[:'exported_object'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["export"]) + return false unless object_validator.valid?(@object) + status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) + return false unless status_validator.valid?(@status) + exported_object_validator = EnumAttributeValidator.new('String', ["voucher", "redemption", "customer", "publication", "order", "points_expiration", "voucher_transactions"]) + return false unless exported_object_validator.valid?(@exported_object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + status == o.status && + channel == o.channel && + result == o.result && + user_id == o.user_id && + exported_object == o.exported_object && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, status, channel, result, user_id, exported_object, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/exports_create_response_body_parameters.rb b/lib/VoucherifySdk/models/exports_create_response_body_parameters.rb new file mode 100644 index 00000000..17a5e52a --- /dev/null +++ b/lib/VoucherifySdk/models/exports_create_response_body_parameters.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsCreateResponseBodyParameters + attr_accessor :order + + # Array of strings containing the data in the export. These fields define the headers in the CSV file. + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'String', + :'fields' => :'Array', + :'filters' => :'ExportsCreateResponseBodyParametersFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order', + :'fields', + :'filters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + order_validator = EnumAttributeValidator.new('String', ["-created_at", "created_at", "-updated_at", "updated_at", "-code", "code", "-id", "id", "-voucher_code", "voucher_code", "-tracking_id", "tracking_id", "-customer_id", "customer_id"]) + return false unless order_validator.valid?(@order) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_create_response_body_parameters_filters.rb b/lib/VoucherifySdk/models/exports_create_response_body_parameters_filters.rb new file mode 100644 index 00000000..37346568 --- /dev/null +++ b/lib/VoucherifySdk/models/exports_create_response_body_parameters_filters.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsCreateResponseBodyParametersFilters + attr_accessor :junction + + attr_accessor :campaign_id + + attr_accessor :voucher_id + + attr_accessor :created_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'campaign_id' => :'campaign_id', + :'voucher_id' => :'voucher_id', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'campaign_id' => :'FieldConditions', + :'voucher_id' => :'FieldConditions', + :'created_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'voucher_id') + self.voucher_id = attributes[:'voucher_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + campaign_id == o.campaign_id && + voucher_id == o.voucher_id && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, campaign_id, voucher_id, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_get_response_body.rb b/lib/VoucherifySdk/models/exports_get_response_body.rb index f0786d48..0f78b604 100644 --- a/lib/VoucherifySdk/models/exports_get_response_body.rb +++ b/lib/VoucherifySdk/models/exports_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/exports/{exportId}`. + # Response body schema for **GET** `v1/exports/{exportId}`. class ExportsGetResponseBody # Unique export ID. attr_accessor :id @@ -36,7 +36,6 @@ class ExportsGetResponseBody # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. attr_accessor :user_id - # The type of object to be exported. attr_accessor :exported_object attr_accessor :parameters @@ -91,47 +90,38 @@ def self.openapi_types :'created_at' => :'Time', :'status' => :'String', :'channel' => :'String', - :'result' => :'ExportBaseResult', + :'result' => :'ExportsGetResponseBodyResult', :'user_id' => :'String', :'exported_object' => :'String', - :'parameters' => :'LoyaltiesMembersTransactionsExportCreateRequestBodyParameters' + :'parameters' => :'ExportsGetResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', :'result', :'user_id', + :'exported_object', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Export' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -142,14 +132,10 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'status') self.status = attributes[:'status'] - else - self.status = nil end if attributes.key?(:'channel') @@ -158,20 +144,14 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] - else - self.user_id = nil end if attributes.key?(:'exported_object') self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher_transactions' end if attributes.key?(:'parameters') @@ -184,26 +164,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - invalid_properties end @@ -211,50 +171,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["export"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) return false unless status_validator.valid?(@status) - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) + exported_object_validator = EnumAttributeValidator.new('String', ["voucher", "redemption", "customer", "publication", "order", "points_expiration", "voucher_transactions"]) return false unless exported_object_validator.valid?(@exported_object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "IN_PROGRESS", "DONE", "ERROR"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/exports_get_response_body_parameters.rb b/lib/VoucherifySdk/models/exports_get_response_body_parameters.rb new file mode 100644 index 00000000..524692e3 --- /dev/null +++ b/lib/VoucherifySdk/models/exports_get_response_body_parameters.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsGetResponseBodyParameters + attr_accessor :order + + # Array of strings containing the data in the export. These fields define the headers in the CSV file. + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'String', + :'fields' => :'Array', + :'filters' => :'ExportsGetResponseBodyParametersFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order', + :'fields', + :'filters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + order_validator = EnumAttributeValidator.new('String', ["-created_at", "created_at", "-updated_at", "updated_at", "-code", "code", "-id", "id", "-voucher_code", "voucher_code", "-tracking_id", "tracking_id", "-customer_id", "customer_id"]) + return false unless order_validator.valid?(@order) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_get_response_body_parameters_filters.rb b/lib/VoucherifySdk/models/exports_get_response_body_parameters_filters.rb new file mode 100644 index 00000000..ab048747 --- /dev/null +++ b/lib/VoucherifySdk/models/exports_get_response_body_parameters_filters.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsGetResponseBodyParametersFilters + attr_accessor :junction + + attr_accessor :campaign_id + + attr_accessor :voucher_id + + attr_accessor :created_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'campaign_id' => :'campaign_id', + :'voucher_id' => :'voucher_id', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'campaign_id' => :'FieldConditions', + :'voucher_id' => :'FieldConditions', + :'created_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'voucher_id') + self.voucher_id = attributes[:'voucher_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + campaign_id == o.campaign_id && + voucher_id == o.voucher_id && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, campaign_id, voucher_id, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_get_response_body_result.rb b/lib/VoucherifySdk/models/exports_get_response_body_result.rb new file mode 100644 index 00000000..f2669dc4 --- /dev/null +++ b/lib/VoucherifySdk/models/exports_get_response_body_result.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ExportsGetResponseBodyResult + # URL of the CSV file location. It contains the token used for authorization in the Download export method. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/exports_list_response_body.rb b/lib/VoucherifySdk/models/exports_list_response_body.rb index 5702809c..2f47f88a 100644 --- a/lib/VoucherifySdk/models/exports_list_response_body.rb +++ b/lib/VoucherifySdk/models/exports_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/exports`. + # Response body schema for **GET** `v1/exports`. class ExportsListResponseBody - # The type of object represented by JSON. This object stores information about exports. + # The type of the object represented by JSON. This object stores information about exports. attr_accessor :object # Identifies the name of the attribute that contains the array of exports. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'exports', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ExportsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ExportsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'exports']).is_a?(Array) self.exports = value end - else - self.exports = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,22 +121,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @exports.nil? - invalid_properties.push('invalid value for "exports", exports cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -151,37 +128,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["exports"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @exports.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["exports"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/field_conditions.rb b/lib/VoucherifySdk/models/field_conditions.rb index 8729aafd..167d7a34 100644 --- a/lib/VoucherifySdk/models/field_conditions.rb +++ b/lib/VoucherifySdk/models/field_conditions.rb @@ -45,15 +45,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::FieldConditions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::FieldConditions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/filter_conditions_string.rb b/lib/VoucherifySdk/models/filter_conditions_string.rb index 7a4a1fae..6ebeee3c 100644 --- a/lib/VoucherifySdk/models/filter_conditions_string.rb +++ b/lib/VoucherifySdk/models/filter_conditions_string.rb @@ -14,18 +14,18 @@ require 'time' module VoucherifySdk - # Data filters used to narrow the data records to be returned in the result. + # Data filters used to narrow down the data records to be returned in the result. class FilterConditionsString - # Array of resource values that should be included in the results. (multiple values) + # Array of resource values that should be included in the results (multiple values). attr_accessor :_in - # Array of resource values that should be included in the results. (multiple values) + # Array of resource values that should be included in the results (multiple values). attr_accessor :not_in - # Value is exactly this value. (single value) + # Value is exactly this value (single value). attr_accessor :is - # Results omit this value. (single value) + # Results omit this value (single value). attr_accessor :is_not # Value is NOT null. The value for this parameter is an empty string. @@ -76,21 +76,22 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not', + :'has_value', + :'is_unknown', + :'starts_with', + :'ends_with' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::FilterConditionsString` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::FilterConditionsString`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/filters_condition.rb b/lib/VoucherifySdk/models/filters_condition.rb index 15db1c4a..153396ca 100644 --- a/lib/VoucherifySdk/models/filters_condition.rb +++ b/lib/VoucherifySdk/models/filters_condition.rb @@ -104,52 +104,70 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'_in' => :'Any', - :'not_in' => :'Any', - :'is' => :'Any', - :'is_days_ago' => :'Any', - :'is_days_in_future' => :'Any', - :'is_not' => :'Any', - :'has_value' => :'Any', - :'is_unknown' => :'Any', - :'contains' => :'Any', - :'not_contain' => :'Any', - :'starts_with' => :'Any', - :'ends_with' => :'Any', - :'more_than' => :'Any', - :'less_than' => :'Any', - :'more_than_ago' => :'Any', - :'less_than_ago' => :'Any', - :'more_than_future' => :'Any', - :'less_than_future' => :'Any', - :'more_than_equal' => :'Any', - :'less_than_equal' => :'Any', - :'after' => :'Any', - :'before' => :'Any', - :'count' => :'Any', - :'count_less' => :'Any', - :'count_more' => :'Any' + :'_in' => :'Object', + :'not_in' => :'Object', + :'is' => :'Object', + :'is_days_ago' => :'Object', + :'is_days_in_future' => :'Object', + :'is_not' => :'Object', + :'has_value' => :'Object', + :'is_unknown' => :'Object', + :'contains' => :'Object', + :'not_contain' => :'Object', + :'starts_with' => :'Object', + :'ends_with' => :'Object', + :'more_than' => :'Object', + :'less_than' => :'Object', + :'more_than_ago' => :'Object', + :'less_than_ago' => :'Object', + :'more_than_future' => :'Object', + :'less_than_future' => :'Object', + :'more_than_equal' => :'Object', + :'less_than_equal' => :'Object', + :'after' => :'Object', + :'before' => :'Object', + :'count' => :'Object', + :'count_less' => :'Object', + :'count_more' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'_in', + :'not_in', + :'is', + :'is_days_ago', + :'is_days_in_future', + :'is_not', + :'has_value', + :'is_unknown', + :'contains', + :'not_contain', + :'starts_with', + :'ends_with', + :'more_than', + :'less_than', + :'more_than_ago', + :'less_than_ago', + :'more_than_future', + :'less_than_future', + :'more_than_equal', + :'less_than_equal', + :'after', + :'before', + :'count', + :'count_less', + :'count_more' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::FiltersCondition` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::FiltersCondition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/gift.rb b/lib/VoucherifySdk/models/gift.rb index f4df7500..0b76e957 100644 --- a/lib/VoucherifySdk/models/gift.rb +++ b/lib/VoucherifySdk/models/gift.rb @@ -73,34 +73,26 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'amount', + :'balance', + :'effect' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Gift` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Gift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'amount') self.amount = attributes[:'amount'] - else - self.amount = nil end if attributes.key?(:'balance') self.balance = attributes[:'balance'] - else - self.balance = nil end if attributes.key?(:'effect') @@ -113,14 +105,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @amount.nil? - invalid_properties.push('invalid value for "amount", amount cannot be nil.') - end - - if @balance.nil? - invalid_properties.push('invalid value for "balance", balance cannot be nil.') - end - invalid_properties end @@ -128,23 +112,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @amount.nil? - return false if @balance.nil? effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) return false unless effect_validator.valid?(@effect) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] effect Object to be assigned - def effect=(effect) - validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) - unless validator.valid?(effect) - fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}." - end - @effect = effect - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/gift_campaign_voucher.rb b/lib/VoucherifySdk/models/gift_campaign_voucher.rb deleted file mode 100644 index e003e886..00000000 --- a/lib/VoucherifySdk/models/gift_campaign_voucher.rb +++ /dev/null @@ -1,291 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Schema model for a discount voucher. - class GiftCampaignVoucher - # Type of voucher. - attr_accessor :type - - attr_accessor :gift - - attr_accessor :redemption - - attr_accessor :code_config - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'gift' => :'gift', - :'redemption' => :'redemption', - :'code_config' => :'code_config' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'gift' => :'Gift', - :'redemption' => :'CampaignLoyaltyVoucherRedemption', - :'code_config' => :'CodeConfig' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::GiftCampaignVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::GiftCampaignVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'GIFT_VOUCHER' - end - - if attributes.key?(:'gift') - self.gift = attributes[:'gift'] - else - self.gift = nil - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'code_config') - self.code_config = attributes[:'code_config'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @gift.nil? - invalid_properties.push('invalid value for "gift", gift cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER"]) - return false unless type_validator.valid?(@type) - return false if @gift.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - gift == o.gift && - redemption == o.redemption && - code_config == o.code_config - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, gift, redemption, code_config].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/giveaway_campaign_voucher.rb b/lib/VoucherifySdk/models/giveaway_campaign_voucher.rb deleted file mode 100644 index b0076437..00000000 --- a/lib/VoucherifySdk/models/giveaway_campaign_voucher.rb +++ /dev/null @@ -1,300 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class GiveawayCampaignVoucher - # Type of voucher. - attr_accessor :type - - attr_accessor :discount - - attr_accessor :code_config - - attr_accessor :redemption - - # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. - attr_accessor :is_referral_code - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'discount' => :'discount', - :'code_config' => :'code_config', - :'redemption' => :'redemption', - :'is_referral_code' => :'is_referral_code' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'discount' => :'Discount', - :'code_config' => :'CodeConfig', - :'redemption' => :'CampaignLoyaltyVoucherRedemption', - :'is_referral_code' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::GiveawayCampaignVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::GiveawayCampaignVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'DISCOUNT_VOUCHER' - end - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - else - self.discount = nil - end - - if attributes.key?(:'code_config') - self.code_config = attributes[:'code_config'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'is_referral_code') - self.is_referral_code = attributes[:'is_referral_code'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @discount.nil? - invalid_properties.push('invalid value for "discount", discount cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER"]) - return false unless type_validator.valid?(@type) - return false if @discount.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - discount == o.discount && - code_config == o.code_config && - redemption == o.redemption && - is_referral_code == o.is_referral_code - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, discount, code_config, redemption, is_referral_code].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/inapplicable_to.rb b/lib/VoucherifySdk/models/inapplicable_to.rb index be787466..80d97cde 100644 --- a/lib/VoucherifySdk/models/inapplicable_to.rb +++ b/lib/VoucherifySdk/models/inapplicable_to.rb @@ -54,6 +54,12 @@ class InapplicableTo attr_accessor :order_item_indices + attr_accessor :repeat + + attr_accessor :skip_initially + + attr_accessor :target + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -92,7 +98,10 @@ def self.attribute_map :'aggregated_quantity_limit' => :'aggregated_quantity_limit', :'amount_limit' => :'amount_limit', :'aggregated_amount_limit' => :'aggregated_amount_limit', - :'order_item_indices' => :'order_item_indices' + :'order_item_indices' => :'order_item_indices', + :'repeat' => :'repeat', + :'skip_initially' => :'skip_initially', + :'target' => :'target' } end @@ -117,48 +126,49 @@ def self.openapi_types :'aggregated_quantity_limit' => :'Integer', :'amount_limit' => :'Integer', :'aggregated_amount_limit' => :'Integer', - :'order_item_indices' => :'Array' + :'order_item_indices' => :'Array', + :'repeat' => :'Integer', + :'skip_initially' => :'Integer', + :'target' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'id', + :'source_id', + :'product_id', + :'product_source_id', + :'strict', + :'price', + :'price_formula', + :'quantity_limit', + :'aggregated_quantity_limit', + :'amount_limit', + :'aggregated_amount_limit', + :'order_item_indices', + :'repeat', + :'skip_initially', + :'target' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ApplicableTo' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::InapplicableTo` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::InapplicableTo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'object') self.object = attributes[:'object'] - else - self.object = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') @@ -175,8 +185,6 @@ def initialize(attributes = {}) if attributes.key?(:'strict') self.strict = attributes[:'strict'] - else - self.strict = nil end if attributes.key?(:'price') @@ -214,25 +222,25 @@ def initialize(attributes = {}) self.order_item_indices = value end end - end - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') + if attributes.key?(:'repeat') + self.repeat = attributes[:'repeat'] end - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') + if attributes.key?(:'skip_initially') + self.skip_initially = attributes[:'skip_initially'] end - if @strict.nil? - invalid_properties.push('invalid value for "strict", strict cannot be nil.') + if attributes.key?(:'target') + self.target = attributes[:'target'] end + end + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new if @effect.nil? invalid_properties.push('invalid value for "effect", effect cannot be nil.') end @@ -244,25 +252,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product", "sku", "products_collection"]) return false unless object_validator.valid?(@object) - return false if @id.nil? - return false if @strict.nil? return false if @effect.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product", "sku", "products_collection"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -281,7 +276,10 @@ def ==(o) aggregated_quantity_limit == o.aggregated_quantity_limit && amount_limit == o.amount_limit && aggregated_amount_limit == o.aggregated_amount_limit && - order_item_indices == o.order_item_indices + order_item_indices == o.order_item_indices && + repeat == o.repeat && + skip_initially == o.skip_initially && + target == o.target end # @see the `==` method @@ -293,7 +291,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [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].hash + [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 end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/inapplicable_to_result_list.rb b/lib/VoucherifySdk/models/inapplicable_to_result_list.rb index 7c387f84..26688ef8 100644 --- a/lib/VoucherifySdk/models/inapplicable_to_result_list.rb +++ b/lib/VoucherifySdk/models/inapplicable_to_result_list.rb @@ -21,10 +21,10 @@ class InapplicableToResultList # Total number of objects defining included products, SKUs, or product collections. attr_accessor :total - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :data_ref class EnumAttributeValidator @@ -77,21 +77,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'data', + :'total', + :'object', + :'data_ref' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::InapplicableToResultList` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::InapplicableToResultList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -99,14 +96,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'object') @@ -127,26 +120,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @total < 0 + if !@total.nil? && @total < 0 invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') end - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - invalid_properties end @@ -154,52 +131,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @data.nil? - return false if @total.nil? - return false if @total < 0 - return false if @object.nil? + return false if !@total.nil? && @total < 0 object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) true end - # Custom attribute writer method with validation - # @param [Object] total Value to be assigned - def total=(total) - if total.nil? - fail ArgumentError, 'total cannot be nil' - end - - if total < 0 - fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' - end - - @total = total - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/list_publications_item_base.rb b/lib/VoucherifySdk/models/list_publications_item_base.rb deleted file mode 100644 index 3014ca30..00000000 --- a/lib/VoucherifySdk/models/list_publications_item_base.rb +++ /dev/null @@ -1,399 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ListPublicationsItemBase - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ListPublicationsItemBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ListPublicationsItemBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - return false if @customer.nil? - return false if @vouchers_id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - customer == o.customer && - vouchers_id == o.vouchers_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, customer, vouchers_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/list_publications_item_invalid.rb b/lib/VoucherifySdk/models/list_publications_item_invalid.rb deleted file mode 100644 index 8bc400b9..00000000 --- a/lib/VoucherifySdk/models/list_publications_item_invalid.rb +++ /dev/null @@ -1,455 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ListPublicationsItemInvalid - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - # Status of the publication attempt. - attr_accessor :result - - # Generic reason as to why the create publication operation failed. - attr_accessor :failure_code - - # This parameter will provide more expanded reason as to why the create publication operation failed. - attr_accessor :failure_message - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id', - :'result' => :'result', - :'failure_code' => :'failure_code', - :'failure_message' => :'failure_message' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array', - :'result' => :'String', - :'failure_code' => :'String', - :'failure_message' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ListPublicationsItemBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ListPublicationsItemInvalid` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ListPublicationsItemInvalid`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = 'FAILURE' - end - - if attributes.key?(:'failure_code') - self.failure_code = attributes[:'failure_code'] - end - - if attributes.key?(:'failure_message') - self.failure_message = attributes[:'failure_message'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - return false if @customer.nil? - return false if @vouchers_id.nil? - return false if @result.nil? - result_validator = EnumAttributeValidator.new('String', ["FAILURE"]) - return false unless result_validator.valid?(@result) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - customer == o.customer && - vouchers_id == o.vouchers_id && - result == o.result && - failure_code == o.failure_code && - failure_message == o.failure_message - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, customer, vouchers_id, result, failure_code, failure_message].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/list_publications_item_valid_multiple_vouchers.rb b/lib/VoucherifySdk/models/list_publications_item_valid_multiple_vouchers.rb deleted file mode 100644 index 5544e929..00000000 --- a/lib/VoucherifySdk/models/list_publications_item_valid_multiple_vouchers.rb +++ /dev/null @@ -1,454 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ListPublicationsItemValidMultipleVouchers - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - # Status of the publication attempt. - attr_accessor :result - - # Contains the unique voucher codes that was assigned by Voucherify. - attr_accessor :vouchers - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id', - :'result' => :'result', - :'vouchers' => :'vouchers' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array', - :'result' => :'String', - :'vouchers' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ListPublicationsItemBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ListPublicationsItemValidMultipleVouchers` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ListPublicationsItemValidMultipleVouchers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = 'SUCCESS' - end - - if attributes.key?(:'vouchers') - if (value = attributes[:'vouchers']).is_a?(Array) - self.vouchers = value - end - else - self.vouchers = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @vouchers.nil? - invalid_properties.push('invalid value for "vouchers", vouchers cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - return false if @customer.nil? - return false if @vouchers_id.nil? - return false if @result.nil? - result_validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - return false unless result_validator.valid?(@result) - return false if @vouchers.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - customer == o.customer && - vouchers_id == o.vouchers_id && - result == o.result && - vouchers == o.vouchers - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, customer, vouchers_id, result, vouchers].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/list_publications_item_valid_single_voucher.rb b/lib/VoucherifySdk/models/list_publications_item_valid_single_voucher.rb deleted file mode 100644 index 45ddbe46..00000000 --- a/lib/VoucherifySdk/models/list_publications_item_valid_single_voucher.rb +++ /dev/null @@ -1,451 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ListPublicationsItemValidSingleVoucher - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - # Status of the publication attempt. - attr_accessor :result - - attr_accessor :voucher - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id', - :'result' => :'result', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array', - :'result' => :'String', - :'voucher' => :'ListPublicationsItemVoucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ListPublicationsItemBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ListPublicationsItemValidSingleVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ListPublicationsItemValidSingleVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = 'SUCCESS' - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - else - self.voucher = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @voucher.nil? - invalid_properties.push('invalid value for "voucher", voucher cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - return false if @customer.nil? - return false if @vouchers_id.nil? - return false if @result.nil? - result_validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - return false unless result_validator.valid?(@result) - return false if @voucher.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - customer == o.customer && - vouchers_id == o.vouchers_id && - result == o.result && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, customer, vouchers_id, result, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/list_publications_item_voucher.rb b/lib/VoucherifySdk/models/list_publications_item_voucher.rb index 382ce306..816082c2 100644 --- a/lib/VoucherifySdk/models/list_publications_item_voucher.rb +++ b/lib/VoucherifySdk/models/list_publications_item_voucher.rb @@ -18,7 +18,7 @@ class ListPublicationsItemVoucher # Voucher code. attr_accessor :code - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Campaign name @@ -90,28 +90,24 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code', + :'object', + :'campaign', + :'loyalty_card', + :'is_referral_code' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ListPublicationsItemVoucher` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ListPublicationsItemVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end if attributes.key?(:'object') @@ -122,8 +118,6 @@ def initialize(attributes = {}) if attributes.key?(:'campaign') self.campaign = attributes[:'campaign'] - else - self.campaign = nil end if attributes.key?(:'gift') @@ -148,18 +142,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @campaign.nil? - invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') - end - invalid_properties end @@ -167,24 +149,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["voucher"]) return false unless object_validator.valid?(@object) - return false if @campaign.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_create_campaign_request_body.rb b/lib/VoucherifySdk/models/loyalties_create_campaign_request_body.rb new file mode 100644 index 00000000..382e1376 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_create_campaign_request_body.rb @@ -0,0 +1,438 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request body schema for **POST** `/loyalties`. + class LoyaltiesCreateCampaignRequestBody + # Campaign name. + attr_accessor :name + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + attr_accessor :type + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + attr_accessor :use_voucher_metadata_schema + + # Total number of unique vouchers in campaign (size of campaign). + attr_accessor :vouchers_count + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # Array containing the ID of the validation rule associated with the promotion tier. + attr_accessor :validation_rules + + # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + attr_accessor :category_id + + # The category assigned to the campaign. Either pass this parameter OR the `category_id`. + attr_accessor :category + + # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + attr_accessor :metadata + + # Type of campaign. + attr_accessor :campaign_type + + attr_accessor :voucher + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'type' => :'type', + :'join_once' => :'join_once', + :'auto_join' => :'auto_join', + :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', + :'vouchers_count' => :'vouchers_count', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'validation_rules' => :'validation_rules', + :'category_id' => :'category_id', + :'category' => :'category', + :'metadata' => :'metadata', + :'campaign_type' => :'campaign_type', + :'voucher' => :'voucher' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'description' => :'String', + :'type' => :'String', + :'join_once' => :'Boolean', + :'auto_join' => :'Boolean', + :'use_voucher_metadata_schema' => :'Boolean', + :'vouchers_count' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'activity_duration_after_publishing' => :'String', + :'validation_rules' => :'Array', + :'category_id' => :'String', + :'category' => :'String', + :'metadata' => :'Object', + :'campaign_type' => :'String', + :'voucher' => :'CampaignLoyaltyVoucher' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'description', + :'type', + :'join_once', + :'auto_join', + :'use_voucher_metadata_schema', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'activity_duration_after_publishing', + :'validation_rules', + :'category_id', + :'category', + :'metadata', + :'campaign_type', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'use_voucher_metadata_schema') + self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] + end + + if attributes.key?(:'vouchers_count') + self.vouchers_count = attributes[:'vouchers_count'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'validation_rules') + if (value = attributes[:'validation_rules']).is_a?(Array) + self.validation_rules = value + end + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + else + self.campaign_type = 'LOYALTY_PROGRAM' + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@validation_rules.nil? && @validation_rules.length > 1 + invalid_properties.push('invalid value for "validation_rules", number of items must be less than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + return false if !@validation_rules.nil? && @validation_rules.length > 1 + campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) + return false unless campaign_type_validator.valid?(@campaign_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + description == o.description && + type == o.type && + join_once == o.join_once && + auto_join == o.auto_join && + use_voucher_metadata_schema == o.use_voucher_metadata_schema && + vouchers_count == o.vouchers_count && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + activity_duration_after_publishing == o.activity_duration_after_publishing && + validation_rules == o.validation_rules && + category_id == o.category_id && + category == o.category && + metadata == o.metadata && + campaign_type == o.campaign_type && + voucher == o.voucher + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, description, type, join_once, auto_join, use_voucher_metadata_schema, vouchers_count, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, validation_rules, category_id, category, metadata, campaign_type, voucher].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_create_campaign_response_body.rb b/lib/VoucherifySdk/models/loyalties_create_campaign_response_body.rb new file mode 100644 index 00000000..66d7d3c1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_create_campaign_response_body.rb @@ -0,0 +1,554 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `/loyalties`. + class LoyaltiesCreateCampaignResponseBody + # Unique campaign ID, assigned by Voucherify. + attr_accessor :id + + # Campaign name. + attr_accessor :name + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # Type of campaign. + attr_accessor :campaign_type + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + attr_accessor :type + + attr_accessor :voucher + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + attr_accessor :use_voucher_metadata_schema + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # Total number of unique vouchers in campaign. + attr_accessor :vouchers_count + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + # A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + attr_accessor :metadata + + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique category name. + attr_accessor :category + + # Indicates the status of the campaign creation. + attr_accessor :creation_status + + # Indicates the status of the campaign's voucher generation. + attr_accessor :vouchers_generation_status + + # Indicates whether the resource can be deleted. + attr_accessor :protected + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # Contains details about the category. + attr_accessor :categories + + # The type of the object represented by JSON. This object stores information about the campaign. + attr_accessor :object + + attr_accessor :loyalty_tiers_expiration + + attr_accessor :validation_rules_assignments + + attr_accessor :access_settings_assignments + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'campaign_type' => :'campaign_type', + :'type' => :'type', + :'voucher' => :'voucher', + :'auto_join' => :'auto_join', + :'join_once' => :'join_once', + :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'vouchers_count' => :'vouchers_count', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'active' => :'active', + :'metadata' => :'metadata', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'category' => :'category', + :'creation_status' => :'creation_status', + :'vouchers_generation_status' => :'vouchers_generation_status', + :'protected' => :'protected', + :'category_id' => :'category_id', + :'categories' => :'categories', + :'object' => :'object', + :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'campaign_type' => :'String', + :'type' => :'String', + :'voucher' => :'LoyaltyCampaignVoucher', + :'auto_join' => :'Boolean', + :'join_once' => :'Boolean', + :'use_voucher_metadata_schema' => :'Boolean', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'activity_duration_after_publishing' => :'String', + :'vouchers_count' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'active' => :'Boolean', + :'metadata' => :'Object', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'category' => :'String', + :'creation_status' => :'String', + :'vouchers_generation_status' => :'String', + :'protected' => :'Boolean', + :'category_id' => :'String', + :'categories' => :'Array', + :'object' => :'String', + :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', + :'category_id', + :'categories', + :'object', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + else + self.campaign_type = 'LOYALTY_PROGRAM' + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'use_voucher_metadata_schema') + self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'vouchers_count') + self.vouchers_count = attributes[:'vouchers_count'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'creation_status') + self.creation_status = attributes[:'creation_status'] + end + + if attributes.key?(:'vouchers_generation_status') + self.vouchers_generation_status = attributes[:'vouchers_generation_status'] + end + + if attributes.key?(:'protected') + self.protected = attributes[:'protected'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + + if attributes.key?(:'loyalty_tiers_expiration') + self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) + return false unless campaign_type_validator.valid?(@campaign_type) + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless creation_status_validator.valid?(@creation_status) + vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + campaign_type == o.campaign_type && + type == o.type && + voucher == o.voucher && + auto_join == o.auto_join && + join_once == o.join_once && + use_voucher_metadata_schema == o.use_voucher_metadata_schema && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + activity_duration_after_publishing == o.activity_duration_after_publishing && + vouchers_count == o.vouchers_count && + start_date == o.start_date && + expiration_date == o.expiration_date && + active == o.active && + metadata == o.metadata && + created_at == o.created_at && + updated_at == o.updated_at && + category == o.category && + creation_status == o.creation_status && + vouchers_generation_status == o.vouchers_generation_status && + protected == o.protected && + category_id == o.category_id && + categories == o.categories && + object == o.object && + loyalty_tiers_expiration == o.loyalty_tiers_expiration && + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, loyalty_tiers_expiration, validation_rules_assignments, access_settings_assignments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_delete_response_body.rb b/lib/VoucherifySdk/models/loyalties_delete_response_body.rb index 669919bb..e05edaee 100644 --- a/lib/VoucherifySdk/models/loyalties_delete_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_delete_response_body.rb @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesDeleteResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesDeleteResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item.rb new file mode 100644 index 00000000..6951d30e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item.rb @@ -0,0 +1,360 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItem + # A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + attr_accessor :validation_rule_id + + attr_accessor :loyalty + + attr_accessor :event + + attr_accessor :source + + # A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule + attr_accessor :active + + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + attr_accessor :start_date + + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :metadata + + attr_accessor :segment + + attr_accessor :custom_event + + attr_accessor :loyalty_tier + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'validation_rule_id' => :'validation_rule_id', + :'loyalty' => :'loyalty', + :'event' => :'event', + :'source' => :'source', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'metadata' => :'metadata', + :'segment' => :'segment', + :'custom_event' => :'custom_event', + :'loyalty_tier' => :'loyalty_tier' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'validation_rule_id' => :'String', + :'loyalty' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyalty', + :'event' => :'String', + :'source' => :'LoyaltiesEarningRulesCreateRequestBodyItemSource', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'metadata' => :'Object', + :'segment' => :'LoyaltiesEarningRulesCreateRequestBodyItemSegment', + :'custom_event' => :'LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent', + :'loyalty_tier' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'validation_rule_id', + :'active', + :'start_date', + :'expiration_date', + :'segment', + :'custom_event', + :'loyalty_tier' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'validation_rule_id') + self.validation_rule_id = attributes[:'validation_rule_id'] + end + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + + if attributes.key?(:'event') + self.event = attributes[:'event'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + validation_rule_id == o.validation_rule_id && + loyalty == o.loyalty && + event == o.event && + source == o.source && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + metadata == o.metadata && + segment == o.segment && + custom_event == o.custom_event && + loyalty_tier == o.loyalty_tier + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [validation_rule_id, loyalty, event, source, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, metadata, segment, custom_event, loyalty_tier].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_custom_event.rb new file mode 100644 index 00000000..e6617398 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the schema id of a custom event. **Required** for the custom event option in `event`. + class LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent + # Contains a unique identifier of a custom event schema. Assigned by the Voucherify API. + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty.rb new file mode 100644 index 00000000..6caab300 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty.rb @@ -0,0 +1,291 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItemLoyalty + attr_accessor :type + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + attr_accessor :calculation_type + + attr_accessor :custom_event + + attr_accessor :order_items + + attr_accessor :order + + attr_accessor :customer + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'points' => :'points', + :'calculation_type' => :'calculation_type', + :'custom_event' => :'custom_event', + :'order_items' => :'order_items', + :'order' => :'order', + :'customer' => :'customer' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'points' => :'Integer', + :'calculation_type' => :'String', + :'custom_event' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent', + :'order_items' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems', + :'order' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder', + :'customer' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'custom_event', + :'customer' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["FIXED", "PROPORTIONAL"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["CUSTOM_EVENT_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "CUSTOMER_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + points == o.points && + calculation_type == o.calculation_type && + custom_event == o.custom_event && + order_items == o.order_items && + order == o.order && + customer == o.customer + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, points, calculation_type, custom_event, order_items, order, customer].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event.rb new file mode 100644 index 00000000..80e947f8 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..8d0e9999 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer.rb new file mode 100644 index 00000000..7ad33fbb --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata.rb new file mode 100644 index 00000000..7759e560 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order.rb new file mode 100644 index 00000000..850f40be --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount.rb new file mode 100644 index 00000000..0872244a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items.rb new file mode 100644 index 00000000..e92458f5 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount.rb new file mode 100644 index 00000000..e486e18e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..1f698151 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..8f5d983b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata.rb new file mode 100644 index 00000000..66832e7a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount.rb new file mode 100644 index 00000000..64fa4588 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_tier.rb new file mode 100644 index 00000000..a93fdb5d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_segment.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_segment.rb new file mode 100644 index 00000000..ef49a854 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. **Required** for the `customer.segment.entered` option in `event`. + class LoyaltiesEarningRulesCreateRequestBodyItemSegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_source.rb new file mode 100644 index 00000000..92fb2e83 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_source.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateRequestBodyItemSource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body.rb new file mode 100644 index 00000000..4c2f71f8 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body.rb @@ -0,0 +1,424 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules`. + class LoyaltiesEarningRulesCreateResponseBody + # Assigned by the Voucherify API, identifies the earning rule object. + attr_accessor :id + + # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + attr_accessor :loyalty + + attr_accessor :event + + attr_accessor :custom_event + + attr_accessor :segment + + attr_accessor :loyalty_tier + + attr_accessor :source + + # The type of the object represented by JSON. Default is earning_rule. + attr_accessor :object + + # For internal use by Voucherify. + attr_accessor :automation_id + + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + attr_accessor :start_date + + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + attr_accessor :metadata + + # A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + attr_accessor :validation_rule_id + + # Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + attr_accessor :updated_at + + # A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule + attr_accessor :active + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'loyalty' => :'loyalty', + :'event' => :'event', + :'custom_event' => :'custom_event', + :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', + :'source' => :'source', + :'object' => :'object', + :'automation_id' => :'automation_id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'metadata' => :'metadata', + :'validation_rule_id' => :'validation_rule_id', + :'updated_at' => :'updated_at', + :'active' => :'active' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'loyalty' => :'LoyaltiesEarningRulesCreateResponseBodyLoyalty', + :'event' => :'String', + :'custom_event' => :'LoyaltiesEarningRulesCreateResponseBodyCustomEvent', + :'segment' => :'LoyaltiesEarningRulesCreateResponseBodySegment', + :'loyalty_tier' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier', + :'source' => :'LoyaltiesEarningRulesCreateResponseBodySource', + :'object' => :'String', + :'automation_id' => :'String', + :'start_date' => :'String', + :'expiration_date' => :'String', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'metadata' => :'Object', + :'validation_rule_id' => :'String', + :'updated_at' => :'Time', + :'active' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'loyalty', + :'custom_event', + :'segment', + :'loyalty_tier', + :'source', + :'object', + :'automation_id', + :'start_date', + :'expiration_date', + :'metadata', + :'validation_rule_id', + :'updated_at', + :'active' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + + if attributes.key?(:'event') + self.event = attributes[:'event'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'earning_rule' + end + + if attributes.key?(:'automation_id') + self.automation_id = attributes[:'automation_id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'validation_rule_id') + self.validation_rule_id = attributes[:'validation_rule_id'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + loyalty == o.loyalty && + event == o.event && + custom_event == o.custom_event && + segment == o.segment && + loyalty_tier == o.loyalty_tier && + source == o.source && + object == o.object && + automation_id == o.automation_id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + metadata == o.metadata && + validation_rule_id == o.validation_rule_id && + updated_at == o.updated_at && + active == o.active + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [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 + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_custom_event.rb new file mode 100644 index 00000000..c81be594 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the custom event. + class LoyaltiesEarningRulesCreateResponseBodyCustomEvent + # Unique identifier of the custom event schema + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty.rb new file mode 100644 index 00000000..e2d38629 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateResponseBodyLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder', + :'order_items' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems', + :'customer' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer', + :'custom_event' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event.rb new file mode 100644 index 00000000..490851f1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..82f1cac6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer.rb new file mode 100644 index 00000000..a7698a4e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata.rb new file mode 100644 index 00000000..98a42042 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order.rb new file mode 100644 index 00000000..4fa0a417 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_amount.rb new file mode 100644 index 00000000..6fecb263 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items.rb new file mode 100644 index 00000000..5a4c4457 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount.rb new file mode 100644 index 00000000..e0a44c92 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..fe4bb4a5 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..cdb254da --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata.rb new file mode 100644 index 00000000..f2300ece --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount.rb new file mode 100644 index 00000000..908c1502 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_tier.rb new file mode 100644 index 00000000..0a24a94e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_segment.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_segment.rb new file mode 100644 index 00000000..0de32cd0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + class LoyaltiesEarningRulesCreateResponseBodySegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_source.rb new file mode 100644 index 00000000..e33d9e9e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_source.rb @@ -0,0 +1,258 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class LoyaltiesEarningRulesCreateResponseBodySource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # A unique campaign identifier assigned by the Voucherify API. + attr_accessor :object_id + + # Defines the object associated with the earning rule. Defaults to `campaign`. + attr_accessor :object_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner', + :'object_id' => :'object_id', + :'object_type' => :'object_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String', + :'object_id' => :'String', + :'object_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner', + :'object_id', + :'object_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'object_id') + self.object_id = attributes[:'object_id'] + end + + if attributes.key?(:'object_type') + self.object_type = attributes[:'object_type'] + else + self.object_type = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless object_type_validator.valid?(@object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner && + object_id == o.object_id && + object_type == o.object_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner, object_id, object_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body.rb index fc3b882f..9f1f507c 100644 --- a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body.rb @@ -14,12 +14,12 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable` + # Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable` class LoyaltiesEarningRulesDisableResponseBody # Assigned by the Voucherify API, identifies the earning rule object. attr_accessor :id - # Timestamp representing the date and time when the earning rule was created in ISO 8601 format. + # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at attr_accessor :loyalty @@ -30,25 +30,29 @@ class LoyaltiesEarningRulesDisableResponseBody attr_accessor :segment + attr_accessor :loyalty_tier + attr_accessor :source - # The type of object represented by JSON. Default is earning_rule. + # The type of the object represented by JSON. Default is earning_rule. attr_accessor :object # For internal use by Voucherify. attr_accessor :automation_id - # Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. attr_accessor :start_date - # Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. attr_accessor :expiration_date attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. attr_accessor :metadata @@ -89,6 +93,7 @@ def self.attribute_map :'event' => :'event', :'custom_event' => :'custom_event', :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', :'source' => :'source', :'object' => :'object', :'automation_id' => :'automation_id', @@ -96,6 +101,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'metadata' => :'metadata', :'updated_at' => :'updated_at', :'active' => :'active' @@ -112,17 +118,19 @@ def self.openapi_types { :'id' => :'String', :'created_at' => :'Time', - :'loyalty' => :'EarningRuleBaseLoyalty', - :'event' => :'EarningRuleEvent', - :'custom_event' => :'EarningRuleBaseCustomEvent', - :'segment' => :'EarningRuleBaseSegment', - :'source' => :'EarningRuleBaseSource', + :'loyalty' => :'LoyaltiesEarningRulesDisableResponseBodyLoyalty', + :'event' => :'String', + :'custom_event' => :'LoyaltiesEarningRulesDisableResponseBodyCustomEvent', + :'segment' => :'LoyaltiesEarningRulesDisableResponseBodySegment', + :'loyalty_tier' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier', + :'source' => :'LoyaltiesEarningRulesDisableResponseBodySource', :'object' => :'String', :'automation_id' => :'String', :'start_date' => :'String', :'expiration_date' => :'String', - :'validity_timeframe' => :'EarningRuleBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'metadata' => :'Object', :'updated_at' => :'Time', :'active' => :'Boolean' @@ -132,48 +140,41 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'loyalty', + :'custom_event', + :'segment', + :'loyalty_tier', + :'source', + :'object', + :'automation_id', + :'start_date', + :'expiration_date', + :'metadata', :'updated_at', + :'active' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EarningRuleBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesEarningRulesDisableResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesEarningRulesDisableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'event') @@ -188,10 +189,12 @@ def initialize(attributes = {}) self.segment = attributes[:'segment'] end + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end if attributes.key?(:'object') @@ -202,8 +205,6 @@ def initialize(attributes = {}) if attributes.key?(:'automation_id') self.automation_id = attributes[:'automation_id'] - else - self.automation_id = nil end if attributes.key?(:'start_date') @@ -224,16 +225,16 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'active') @@ -248,38 +249,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - if @source.nil? - invalid_properties.push('invalid value for "source", source cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @automation_id.nil? - invalid_properties.push('invalid value for "automation_id", automation_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @active.nil? - invalid_properties.push('invalid value for "active", active cannot be nil.') - end - invalid_properties end @@ -287,29 +256,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @created_at.nil? - return false if @loyalty.nil? - return false if @source.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) return false unless object_validator.valid?(@object) - return false if @automation_id.nil? - return false if @metadata.nil? - return false if @active.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["earning_rule"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -321,6 +272,7 @@ def ==(o) event == o.event && custom_event == o.custom_event && segment == o.segment && + loyalty_tier == o.loyalty_tier && source == o.source && object == o.object && automation_id == o.automation_id && @@ -328,6 +280,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && metadata == o.metadata && updated_at == o.updated_at && active == o.active @@ -342,7 +295,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, loyalty, event, custom_event, segment, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, metadata, updated_at, active].hash + [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 end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_custom_event.rb new file mode 100644 index 00000000..e570aea1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the custom event. + class LoyaltiesEarningRulesDisableResponseBodyCustomEvent + # Unique identifier of the custom event schema + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty.rb new file mode 100644 index 00000000..bab92008 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesDisableResponseBodyLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder', + :'order_items' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems', + :'customer' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer', + :'custom_event' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event.rb new file mode 100644 index 00000000..9b24d0e6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..7b0d0fc2 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer.rb new file mode 100644 index 00000000..9167dbe6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata.rb new file mode 100644 index 00000000..fd07a301 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order.rb new file mode 100644 index 00000000..a3101c6f --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount.rb new file mode 100644 index 00000000..cee64ae0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items.rb new file mode 100644 index 00000000..e54b0f6d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount.rb new file mode 100644 index 00000000..3f80aca3 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..2a22489d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..63782dbe --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata.rb new file mode 100644 index 00000000..6303f8d1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount.rb new file mode 100644 index 00000000..bfb567e2 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_tier.rb new file mode 100644 index 00000000..1943f9e8 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_segment.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_segment.rb new file mode 100644 index 00000000..22e5b3a4 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + class LoyaltiesEarningRulesDisableResponseBodySegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_source.rb new file mode 100644 index 00000000..0c906e21 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_source.rb @@ -0,0 +1,258 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class LoyaltiesEarningRulesDisableResponseBodySource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # A unique campaign identifier assigned by the Voucherify API. + attr_accessor :object_id + + # Defines the object associated with the earning rule. Defaults to `campaign`. + attr_accessor :object_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner', + :'object_id' => :'object_id', + :'object_type' => :'object_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String', + :'object_id' => :'String', + :'object_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner', + :'object_id', + :'object_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'object_id') + self.object_id = attributes[:'object_id'] + end + + if attributes.key?(:'object_type') + self.object_type = attributes[:'object_type'] + else + self.object_type = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless object_type_validator.valid?(@object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner && + object_id == o.object_id && + object_type == o.object_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner, object_id, object_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body.rb index 5639703a..bd3c9c71 100644 --- a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body.rb @@ -14,12 +14,12 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable` + # Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable` class LoyaltiesEarningRulesEnableResponseBody # Assigned by the Voucherify API, identifies the earning rule object. attr_accessor :id - # Timestamp representing the date and time when the earning rule was created in ISO 8601 format. + # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at attr_accessor :loyalty @@ -30,25 +30,29 @@ class LoyaltiesEarningRulesEnableResponseBody attr_accessor :segment + attr_accessor :loyalty_tier + attr_accessor :source - # The type of object represented by JSON. Default is earning_rule. + # The type of the object represented by JSON. Default is earning_rule. attr_accessor :object # For internal use by Voucherify. attr_accessor :automation_id - # Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. attr_accessor :start_date - # Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. attr_accessor :expiration_date attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. attr_accessor :metadata @@ -89,6 +93,7 @@ def self.attribute_map :'event' => :'event', :'custom_event' => :'custom_event', :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', :'source' => :'source', :'object' => :'object', :'automation_id' => :'automation_id', @@ -96,6 +101,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'metadata' => :'metadata', :'updated_at' => :'updated_at', :'active' => :'active' @@ -112,17 +118,19 @@ def self.openapi_types { :'id' => :'String', :'created_at' => :'Time', - :'loyalty' => :'EarningRuleBaseLoyalty', - :'event' => :'EarningRuleEvent', - :'custom_event' => :'EarningRuleBaseCustomEvent', - :'segment' => :'EarningRuleBaseSegment', - :'source' => :'EarningRuleBaseSource', + :'loyalty' => :'LoyaltiesEarningRulesEnableResponseBodyLoyalty', + :'event' => :'String', + :'custom_event' => :'LoyaltiesEarningRulesEnableResponseBodyCustomEvent', + :'segment' => :'LoyaltiesEarningRulesEnableResponseBodySegment', + :'loyalty_tier' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier', + :'source' => :'LoyaltiesEarningRulesEnableResponseBodySource', :'object' => :'String', :'automation_id' => :'String', :'start_date' => :'String', :'expiration_date' => :'String', - :'validity_timeframe' => :'EarningRuleBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'metadata' => :'Object', :'updated_at' => :'Time', :'active' => :'Boolean' @@ -132,48 +140,41 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'loyalty', + :'custom_event', + :'segment', + :'loyalty_tier', + :'source', + :'object', + :'automation_id', + :'start_date', + :'expiration_date', + :'metadata', :'updated_at', + :'active' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EarningRuleBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesEarningRulesEnableResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesEarningRulesEnableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'event') @@ -188,10 +189,12 @@ def initialize(attributes = {}) self.segment = attributes[:'segment'] end + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end if attributes.key?(:'object') @@ -202,8 +205,6 @@ def initialize(attributes = {}) if attributes.key?(:'automation_id') self.automation_id = attributes[:'automation_id'] - else - self.automation_id = nil end if attributes.key?(:'start_date') @@ -224,16 +225,16 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'active') @@ -248,38 +249,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - if @source.nil? - invalid_properties.push('invalid value for "source", source cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @automation_id.nil? - invalid_properties.push('invalid value for "automation_id", automation_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @active.nil? - invalid_properties.push('invalid value for "active", active cannot be nil.') - end - invalid_properties end @@ -287,29 +256,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @created_at.nil? - return false if @loyalty.nil? - return false if @source.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) return false unless object_validator.valid?(@object) - return false if @automation_id.nil? - return false if @metadata.nil? - return false if @active.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["earning_rule"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -321,6 +272,7 @@ def ==(o) event == o.event && custom_event == o.custom_event && segment == o.segment && + loyalty_tier == o.loyalty_tier && source == o.source && object == o.object && automation_id == o.automation_id && @@ -328,6 +280,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && metadata == o.metadata && updated_at == o.updated_at && active == o.active @@ -342,7 +295,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, loyalty, event, custom_event, segment, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, metadata, updated_at, active].hash + [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 end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_custom_event.rb new file mode 100644 index 00000000..e4a15257 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the custom event. + class LoyaltiesEarningRulesEnableResponseBodyCustomEvent + # Unique identifier of the custom event schema + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty.rb new file mode 100644 index 00000000..75722c08 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesEnableResponseBodyLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder', + :'order_items' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems', + :'customer' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer', + :'custom_event' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event.rb new file mode 100644 index 00000000..79c309f8 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..d85b1acf --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer.rb new file mode 100644 index 00000000..9184f86e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata.rb new file mode 100644 index 00000000..c15a7bbc --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order.rb new file mode 100644 index 00000000..78032890 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount.rb new file mode 100644 index 00000000..72d2a6ff --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items.rb new file mode 100644 index 00000000..f1d02ae9 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount.rb new file mode 100644 index 00000000..28430d16 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..8868ff30 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..e3c765de --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata.rb new file mode 100644 index 00000000..fc8a0681 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount.rb new file mode 100644 index 00000000..15ac1d46 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_tier.rb new file mode 100644 index 00000000..df5b2c6e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_segment.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_segment.rb new file mode 100644 index 00000000..3ca0815a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + class LoyaltiesEarningRulesEnableResponseBodySegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_source.rb new file mode 100644 index 00000000..bef5a050 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_source.rb @@ -0,0 +1,258 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class LoyaltiesEarningRulesEnableResponseBodySource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # A unique campaign identifier assigned by the Voucherify API. + attr_accessor :object_id + + # Defines the object associated with the earning rule. Defaults to `campaign`. + attr_accessor :object_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner', + :'object_id' => :'object_id', + :'object_type' => :'object_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String', + :'object_id' => :'String', + :'object_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner', + :'object_id', + :'object_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'object_id') + self.object_id = attributes[:'object_id'] + end + + if attributes.key?(:'object_type') + self.object_type = attributes[:'object_type'] + else + self.object_type = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless object_type_validator.valid?(@object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner && + object_id == o.object_id && + object_type == o.object_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner, object_id, object_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body.rb index 8eed8842..def97907 100644 --- a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body.rb @@ -14,12 +14,12 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/earning-rules/{earningRuleId}`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}`. class LoyaltiesEarningRulesGetResponseBody # Assigned by the Voucherify API, identifies the earning rule object. attr_accessor :id - # Timestamp representing the date and time when the earning rule was created in ISO 8601 format. + # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at attr_accessor :loyalty @@ -30,25 +30,29 @@ class LoyaltiesEarningRulesGetResponseBody attr_accessor :segment + attr_accessor :loyalty_tier + attr_accessor :source - # The type of object represented by JSON. Default is earning_rule. + # The type of the object represented by JSON. Default is earning_rule. attr_accessor :object # For internal use by Voucherify. attr_accessor :automation_id - # Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. attr_accessor :start_date - # Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. attr_accessor :expiration_date attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. attr_accessor :metadata @@ -92,6 +96,7 @@ def self.attribute_map :'event' => :'event', :'custom_event' => :'custom_event', :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', :'source' => :'source', :'object' => :'object', :'automation_id' => :'automation_id', @@ -99,6 +104,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'metadata' => :'metadata', :'validation_rule_id' => :'validation_rule_id', :'updated_at' => :'updated_at', @@ -116,17 +122,19 @@ def self.openapi_types { :'id' => :'String', :'created_at' => :'Time', - :'loyalty' => :'EarningRuleBaseLoyalty', - :'event' => :'EarningRuleEvent', - :'custom_event' => :'EarningRuleBaseCustomEvent', - :'segment' => :'EarningRuleBaseSegment', - :'source' => :'EarningRuleBaseSource', + :'loyalty' => :'LoyaltiesEarningRulesGetResponseBodyLoyalty', + :'event' => :'String', + :'custom_event' => :'LoyaltiesEarningRulesGetResponseBodyCustomEvent', + :'segment' => :'LoyaltiesEarningRulesGetResponseBodySegment', + :'loyalty_tier' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyTier', + :'source' => :'LoyaltiesEarningRulesGetResponseBodySource', :'object' => :'String', :'automation_id' => :'String', :'start_date' => :'String', :'expiration_date' => :'String', - :'validity_timeframe' => :'EarningRuleBaseValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'metadata' => :'Object', :'validation_rule_id' => :'String', :'updated_at' => :'Time', @@ -137,49 +145,42 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'loyalty', + :'custom_event', + :'segment', + :'loyalty_tier', + :'source', + :'object', + :'automation_id', + :'start_date', + :'expiration_date', + :'metadata', :'validation_rule_id', :'updated_at', + :'active' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'EarningRule' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesEarningRulesGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesEarningRulesGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'loyalty') self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil end if attributes.key?(:'event') @@ -194,10 +195,12 @@ def initialize(attributes = {}) self.segment = attributes[:'segment'] end + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end if attributes.key?(:'object') @@ -208,8 +211,6 @@ def initialize(attributes = {}) if attributes.key?(:'automation_id') self.automation_id = attributes[:'automation_id'] - else - self.automation_id = nil end if attributes.key?(:'start_date') @@ -230,28 +231,24 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'validation_rule_id') self.validation_rule_id = attributes[:'validation_rule_id'] - else - self.validation_rule_id = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'active') self.active = attributes[:'active'] - else - self.active = nil end end @@ -260,38 +257,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - if @source.nil? - invalid_properties.push('invalid value for "source", source cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @automation_id.nil? - invalid_properties.push('invalid value for "automation_id", automation_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @active.nil? - invalid_properties.push('invalid value for "active", active cannot be nil.') - end - invalid_properties end @@ -299,29 +264,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @created_at.nil? - return false if @loyalty.nil? - return false if @source.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) return false unless object_validator.valid?(@object) - return false if @automation_id.nil? - return false if @metadata.nil? - return false if @active.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["earning_rule"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -333,6 +280,7 @@ def ==(o) event == o.event && custom_event == o.custom_event && segment == o.segment && + loyalty_tier == o.loyalty_tier && source == o.source && object == o.object && automation_id == o.automation_id && @@ -340,6 +288,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && metadata == o.metadata && validation_rule_id == o.validation_rule_id && updated_at == o.updated_at && @@ -355,7 +304,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, loyalty, event, custom_event, segment, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, metadata, validation_rule_id, updated_at, active].hash + [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 end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_custom_event.rb new file mode 100644 index 00000000..22b5b45a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the custom event. + class LoyaltiesEarningRulesGetResponseBodyCustomEvent + # Unique identifier of the custom event schema + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty.rb new file mode 100644 index 00000000..23ce0fd0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesGetResponseBodyLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder', + :'order_items' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems', + :'customer' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer', + :'custom_event' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event.rb new file mode 100644 index 00000000..bb0a845a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..96776a57 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer.rb new file mode 100644 index 00000000..5d7a2c22 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata.rb new file mode 100644 index 00000000..ed21a942 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order.rb new file mode 100644 index 00000000..4ac89283 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_amount.rb new file mode 100644 index 00000000..54190621 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items.rb new file mode 100644 index 00000000..4d45c70b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount.rb new file mode 100644 index 00000000..c5772d96 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..c85d2fbd --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..09cdf07b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata.rb new file mode 100644 index 00000000..c9ed20aa --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount.rb new file mode 100644 index 00000000..90976a58 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_tier.rb new file mode 100644 index 00000000..9ebc05dd --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class LoyaltiesEarningRulesGetResponseBodyLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_segment.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_segment.rb new file mode 100644 index 00000000..321a76ed --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + class LoyaltiesEarningRulesGetResponseBodySegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_source.rb new file mode 100644 index 00000000..96aebafc --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_source.rb @@ -0,0 +1,258 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class LoyaltiesEarningRulesGetResponseBodySource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # A unique campaign identifier assigned by the Voucherify API. + attr_accessor :object_id + + # Defines the object associated with the earning rule. Defaults to `campaign`. + attr_accessor :object_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner', + :'object_id' => :'object_id', + :'object_type' => :'object_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String', + :'object_id' => :'String', + :'object_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner', + :'object_id', + :'object_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'object_id') + self.object_id = attributes[:'object_id'] + end + + if attributes.key?(:'object_type') + self.object_type = attributes[:'object_type'] + else + self.object_type = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless object_type_validator.valid?(@object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner && + object_id == o.object_id && + object_type == o.object_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner, object_id, object_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_list_response_body.rb new file mode 100644 index 00000000..0c2245a0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_list_response_body.rb @@ -0,0 +1,273 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for listing earning rules using **GET** `v1/loyalties/{campaignId}/earning-rules` endpoint. + class LoyaltiesEarningRulesListResponseBody + # The type of the object represented by JSON. This object stores information about earning rules in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of earning rule objects. + attr_accessor :data_ref + + # Contains array of earning rule objects. + attr_accessor :data + + # Total number of earning rule objects. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body.rb new file mode 100644 index 00000000..a373fa48 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body.rb @@ -0,0 +1,325 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateRequestBody + # A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + attr_accessor :validation_rule_id + + attr_accessor :loyalty + + attr_accessor :source + + # A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule + attr_accessor :active + + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + attr_accessor :start_date + + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + attr_accessor :metadata + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'validation_rule_id' => :'validation_rule_id', + :'loyalty' => :'loyalty', + :'source' => :'source', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'validation_rule_id' => :'String', + :'loyalty' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyalty', + :'source' => :'LoyaltiesEarningRulesUpdateRequestBodySource', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'metadata' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'validation_rule_id', + :'loyalty', + :'source', + :'active', + :'start_date', + :'expiration_date', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'validation_rule_id') + self.validation_rule_id = attributes[:'validation_rule_id'] + end + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + validation_rule_id == o.validation_rule_id && + loyalty == o.loyalty && + source == o.source && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [validation_rule_id, loyalty, source, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty.rb new file mode 100644 index 00000000..35d5e142 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateRequestBodyLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder', + :'order_items' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems', + :'customer' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer', + :'custom_event' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event.rb new file mode 100644 index 00000000..5fc3630f --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..50a6c002 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer.rb new file mode 100644 index 00000000..c74a265d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata.rb new file mode 100644 index 00000000..bb298bec --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order.rb new file mode 100644 index 00000000..2bc99025 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_amount.rb new file mode 100644 index 00000000..eea63452 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items.rb new file mode 100644 index 00000000..993b24a2 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount.rb new file mode 100644 index 00000000..ad164abe --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..07fbfc73 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..ecd06ec3 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata.rb new file mode 100644 index 00000000..a9c82a66 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount.rb new file mode 100644 index 00000000..0ecbdc22 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_source.rb new file mode 100644 index 00000000..5dac77a9 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body_source.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class LoyaltiesEarningRulesUpdateRequestBodySource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body.rb new file mode 100644 index 00000000..2f12a28b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body.rb @@ -0,0 +1,424 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}`. + class LoyaltiesEarningRulesUpdateResponseBody + # Assigned by the Voucherify API, identifies the earning rule object. + attr_accessor :id + + # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + attr_accessor :loyalty + + attr_accessor :event + + attr_accessor :custom_event + + attr_accessor :segment + + attr_accessor :loyalty_tier + + attr_accessor :source + + # The type of the object represented by JSON. Default is earning_rule. + attr_accessor :object + + # For internal use by Voucherify. + attr_accessor :automation_id + + # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + attr_accessor :start_date + + # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + attr_accessor :metadata + + # A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + attr_accessor :validation_rule_id + + # Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + attr_accessor :updated_at + + # A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule + attr_accessor :active + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'loyalty' => :'loyalty', + :'event' => :'event', + :'custom_event' => :'custom_event', + :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', + :'source' => :'source', + :'object' => :'object', + :'automation_id' => :'automation_id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'metadata' => :'metadata', + :'validation_rule_id' => :'validation_rule_id', + :'updated_at' => :'updated_at', + :'active' => :'active' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'loyalty' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyalty', + :'event' => :'String', + :'custom_event' => :'LoyaltiesEarningRulesUpdateResponseBodyCustomEvent', + :'segment' => :'LoyaltiesEarningRulesUpdateResponseBodySegment', + :'loyalty_tier' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier', + :'source' => :'LoyaltiesEarningRulesUpdateResponseBodySource', + :'object' => :'String', + :'automation_id' => :'String', + :'start_date' => :'String', + :'expiration_date' => :'String', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'metadata' => :'Object', + :'validation_rule_id' => :'String', + :'updated_at' => :'Time', + :'active' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'loyalty', + :'custom_event', + :'segment', + :'loyalty_tier', + :'source', + :'object', + :'automation_id', + :'start_date', + :'expiration_date', + :'metadata', + :'validation_rule_id', + :'updated_at', + :'active' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + + if attributes.key?(:'event') + self.event = attributes[:'event'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'earning_rule' + end + + if attributes.key?(:'automation_id') + self.automation_id = attributes[:'automation_id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'validation_rule_id') + self.validation_rule_id = attributes[:'validation_rule_id'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["earning_rule"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + loyalty == o.loyalty && + event == o.event && + custom_event == o.custom_event && + segment == o.segment && + loyalty_tier == o.loyalty_tier && + source == o.source && + object == o.object && + automation_id == o.automation_id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + metadata == o.metadata && + validation_rule_id == o.validation_rule_id && + updated_at == o.updated_at && + active == o.active + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [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 + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_custom_event.rb new file mode 100644 index 00000000..04b6308c --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_custom_event.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the custom event. + class LoyaltiesEarningRulesUpdateResponseBodyCustomEvent + # Unique identifier of the custom event schema + attr_accessor :schema_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'schema_id' => :'schema_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'schema_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'schema_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'schema_id') + self.schema_id = attributes[:'schema_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + schema_id == o.schema_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [schema_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty.rb new file mode 100644 index 00000000..79b4ee2e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty.rb @@ -0,0 +1,295 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateResponseBodyLoyalty + attr_accessor :type + + attr_accessor :calculation_type + + attr_accessor :order + + attr_accessor :order_items + + attr_accessor :customer + + attr_accessor :custom_event + + # Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'calculation_type' => :'calculation_type', + :'order' => :'order', + :'order_items' => :'order_items', + :'customer' => :'customer', + :'custom_event' => :'custom_event', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'calculation_type' => :'String', + :'order' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder', + :'order_items' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems', + :'customer' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer', + :'custom_event' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'calculation_type', + :'order', + :'order_items', + :'customer', + :'custom_event', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'calculation_type') + self.calculation_type = attributes[:'calculation_type'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'order_items') + self.order_items = attributes[:'order_items'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["PROPORTIONAL", "FIXED"]) + return false unless type_validator.valid?(@type) + calculation_type_validator = EnumAttributeValidator.new('String', ["ORDER_AMOUNT", "ORDER_TOTAL_AMOUNT", "ORDER_METADATA", "ORDER_ITEMS_QUANTITY", "ORDER_ITEMS_AMOUNT", "ORDER_ITEMS_SUBTOTAL_AMOUNT", "CUSTOMER_METADATA", "CUSTOM_EVENT_METADATA"]) + return false unless calculation_type_validator.valid?(@calculation_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + calculation_type == o.calculation_type && + order == o.order && + order_items == o.order_items && + customer == o.customer && + custom_event == o.custom_event && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, calculation_type, order, order_items, customer, custom_event, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event.rb new file mode 100644 index 00000000..98fb722d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata.rb new file mode 100644 index 00000000..4c6af62c --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Custom event metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer.rb new file mode 100644 index 00000000..7b1279d6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'metadata' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata.rb new file mode 100644 index 00000000..fc0d113f --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata + # For how many increments of the customer metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Customer metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order.rb new file mode 100644 index 00000000..b149de4a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder + attr_accessor :amount + + attr_accessor :total_amount + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'total_amount' => :'total_amount', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount', + :'total_amount' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount', + :'metadata' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'total_amount', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + total_amount == o.total_amount && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, total_amount, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_amount.rb new file mode 100644 index 00000000..171b850a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items.rb new file mode 100644 index 00000000..dfc4a998 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems + attr_accessor :quantity + + attr_accessor :amount + + attr_accessor :subtotal_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'amount' => :'amount', + :'subtotal_amount' => :'subtotal_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity', + :'amount' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount', + :'subtotal_amount' => :'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'amount', + :'subtotal_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + amount == o.amount && + subtotal_amount == o.subtotal_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, amount, subtotal_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount.rb new file mode 100644 index 00000000..533bfa3a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity.rb new file mode 100644 index 00000000..8cfb1442 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount.rb new file mode 100644 index 00000000..da40dda8 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Type of object taken under consideration. + attr_accessor :object + + # Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + attr_accessor :id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'object' => :'object', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'object' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'object', + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["products_collection", "product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + object == o.object && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, object, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata.rb new file mode 100644 index 00000000..74fcf956 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata.rb @@ -0,0 +1,232 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata + # For how many increments of the order metadata property to grant points for. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Order metadata property. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points', + :'property' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount.rb new file mode 100644 index 00000000..a9b2bd87 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount + # Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + attr_accessor :every + + # Number of points to be awarded, i.e. how many points to be added to the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'every' => :'every', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'every' => :'Integer', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'every', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'every') + self.every = attributes[:'every'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + every == o.every && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [every, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_tier.rb new file mode 100644 index 00000000..24856f80 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_loyalty_tier.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the tier associated with the earning rule definition. + class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier + # Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_segment.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_segment.rb new file mode 100644 index 00000000..934149f5 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_segment.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + class LoyaltiesEarningRulesUpdateResponseBodySegment + # Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_source.rb b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_source.rb new file mode 100644 index 00000000..aa13e48e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_source.rb @@ -0,0 +1,258 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name and parent campaign. + class LoyaltiesEarningRulesUpdateResponseBodySource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # A unique campaign identifier assigned by the Voucherify API. + attr_accessor :object_id + + # Defines the object associated with the earning rule. Defaults to `campaign`. + attr_accessor :object_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner', + :'object_id' => :'object_id', + :'object_type' => :'object_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String', + :'object_id' => :'String', + :'object_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner', + :'object_id', + :'object_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'object_id') + self.object_id = attributes[:'object_id'] + end + + if attributes.key?(:'object_type') + self.object_type = attributes[:'object_type'] + else + self.object_type = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless object_type_validator.valid?(@object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner && + object_id == o.object_id && + object_type == o.object_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner, object_id, object_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_get_campaign_response_body.rb b/lib/VoucherifySdk/models/loyalties_get_campaign_response_body.rb new file mode 100644 index 00000000..54b50c74 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_get_campaign_response_body.rb @@ -0,0 +1,554 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `/loyalties/{campaignId}`. + class LoyaltiesGetCampaignResponseBody + # Unique campaign ID, assigned by Voucherify. + attr_accessor :id + + # Campaign name. + attr_accessor :name + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # Type of campaign. + attr_accessor :campaign_type + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + attr_accessor :type + + attr_accessor :voucher + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + attr_accessor :use_voucher_metadata_schema + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # Total number of unique vouchers in campaign. + attr_accessor :vouchers_count + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + # A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + attr_accessor :metadata + + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique category name. + attr_accessor :category + + # Indicates the status of the campaign creation. + attr_accessor :creation_status + + # Indicates the status of the campaign's voucher generation. + attr_accessor :vouchers_generation_status + + # Indicates whether the resource can be deleted. + attr_accessor :protected + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # Contains details about the category. + attr_accessor :categories + + # The type of the object represented by JSON. This object stores information about the campaign. + attr_accessor :object + + attr_accessor :loyalty_tiers_expiration + + attr_accessor :validation_rules_assignments + + attr_accessor :access_settings_assignments + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'campaign_type' => :'campaign_type', + :'type' => :'type', + :'voucher' => :'voucher', + :'auto_join' => :'auto_join', + :'join_once' => :'join_once', + :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'vouchers_count' => :'vouchers_count', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'active' => :'active', + :'metadata' => :'metadata', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'category' => :'category', + :'creation_status' => :'creation_status', + :'vouchers_generation_status' => :'vouchers_generation_status', + :'protected' => :'protected', + :'category_id' => :'category_id', + :'categories' => :'categories', + :'object' => :'object', + :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'campaign_type' => :'String', + :'type' => :'String', + :'voucher' => :'LoyaltyCampaignVoucher', + :'auto_join' => :'Boolean', + :'join_once' => :'Boolean', + :'use_voucher_metadata_schema' => :'Boolean', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'activity_duration_after_publishing' => :'String', + :'vouchers_count' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'active' => :'Boolean', + :'metadata' => :'Object', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'category' => :'String', + :'creation_status' => :'String', + :'vouchers_generation_status' => :'String', + :'protected' => :'Boolean', + :'category_id' => :'String', + :'categories' => :'Array', + :'object' => :'String', + :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', + :'category_id', + :'categories', + :'object', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + else + self.campaign_type = 'LOYALTY_PROGRAM' + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'use_voucher_metadata_schema') + self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'vouchers_count') + self.vouchers_count = attributes[:'vouchers_count'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'creation_status') + self.creation_status = attributes[:'creation_status'] + end + + if attributes.key?(:'vouchers_generation_status') + self.vouchers_generation_status = attributes[:'vouchers_generation_status'] + end + + if attributes.key?(:'protected') + self.protected = attributes[:'protected'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + + if attributes.key?(:'loyalty_tiers_expiration') + self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) + return false unless campaign_type_validator.valid?(@campaign_type) + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless creation_status_validator.valid?(@creation_status) + vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + campaign_type == o.campaign_type && + type == o.type && + voucher == o.voucher && + auto_join == o.auto_join && + join_once == o.join_once && + use_voucher_metadata_schema == o.use_voucher_metadata_schema && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + activity_duration_after_publishing == o.activity_duration_after_publishing && + vouchers_count == o.vouchers_count && + start_date == o.start_date && + expiration_date == o.expiration_date && + active == o.active && + metadata == o.metadata && + created_at == o.created_at && + updated_at == o.updated_at && + category == o.category && + creation_status == o.creation_status && + vouchers_generation_status == o.vouchers_generation_status && + protected == o.protected && + category_id == o.category_id && + categories == o.categories && + object == o.object && + loyalty_tiers_expiration == o.loyalty_tiers_expiration && + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, loyalty_tiers_expiration, validation_rules_assignments, access_settings_assignments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_list_campaigns_response_body.rb b/lib/VoucherifySdk/models/loyalties_list_campaigns_response_body.rb new file mode 100644 index 00000000..382ce5da --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_list_campaigns_response_body.rb @@ -0,0 +1,273 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **Get** `/loyalties`. + class LoyaltiesListCampaignsResponseBody + # The type of the object represented by JSON. This object stores information about loyalty campaigns in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of loyalty campaign objects. + attr_accessor :data_ref + + # Contains an array of loyalty campaign objects. + attr_accessor :campaigns + + # Total number of loyalty campaign objects. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'campaigns' => :'campaigns', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'campaigns' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'campaigns', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'campaigns' + end + + if attributes.key?(:'campaigns') + if (value = attributes[:'campaigns']).is_a?(Array) + self.campaigns = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + data_ref_validator = EnumAttributeValidator.new('String', ["campaigns"]) + return false unless data_ref_validator.valid?(@data_ref) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + campaigns == o.campaigns && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, campaigns, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_list_members_response_body.rb b/lib/VoucherifySdk/models/loyalties_list_members_response_body.rb new file mode 100644 index 00000000..4aca0ea0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_list_members_response_body.rb @@ -0,0 +1,273 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/loyalties/{campaignId}/members`. + class LoyaltiesListMembersResponseBody + # The type of the object represented by JSON. This object stores information about members in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of voucher objects. + attr_accessor :data_ref + + # Contains array of voucher objects representing loyalty cards, in other words, loyalty program members. + attr_accessor :vouchers + + # Total number of voucher objects. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'vouchers' => :'vouchers', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'vouchers' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'vouchers', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'vouchers' + end + + if attributes.key?(:'vouchers') + if (value = attributes[:'vouchers']).is_a?(Array) + self.vouchers = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + data_ref_validator = EnumAttributeValidator.new('String', ["vouchers"]) + return false unless data_ref_validator.valid?(@data_ref) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + vouchers == o.vouchers && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, vouchers, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_loyalty_tier_reward.rb b/lib/VoucherifySdk/models/loyalties_loyalty_tier_reward.rb index fd9df993..c3a2ff8f 100644 --- a/lib/VoucherifySdk/models/loyalties_loyalty_tier_reward.rb +++ b/lib/VoucherifySdk/models/loyalties_loyalty_tier_reward.rb @@ -20,7 +20,7 @@ class LoyaltiesLoyaltyTierReward attr_accessor :assignment - # The type of object represented by JSON. This object stores information about the loyalty tier reward. + # The type of the object represented by JSON. This object stores information about the loyalty tier reward. attr_accessor :object class EnumAttributeValidator @@ -77,15 +77,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesLoyaltyTierReward` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesLoyaltyTierReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -140,16 +133,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["loyalty_tier_reward"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_member_activity_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_member_activity_list_response_body.rb new file mode 100644 index 00000000..6d59b547 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_member_activity_list_response_body.rb @@ -0,0 +1,284 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for retrieving member activity. + class LoyaltiesMemberActivityListResponseBody + # The type of the object represented by JSON. This object stores information about member activities in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of member activity objects. + attr_accessor :data_ref + + # Array of member activity objects. + attr_accessor :data + + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. + attr_accessor :has_more + + # Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. + attr_accessor :more_starting_after + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'has_more' => :'has_more', + :'more_starting_after' => :'more_starting_after' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'has_more' => :'Boolean', + :'more_starting_after' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'has_more', + :'more_starting_after' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'more_starting_after') + self.more_starting_after = attributes[:'more_starting_after'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + has_more == o.has_more && + more_starting_after == o.more_starting_after + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, has_more, more_starting_after].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_balance_update_request_body.rb b/lib/VoucherifySdk/models/loyalties_members_balance_update_request_body.rb index fa329aed..ec67cf15 100644 --- a/lib/VoucherifySdk/models/loyalties_members_balance_update_request_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_balance_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request Body schema for **post** `/loyalties/members/{memberId}/balance` and **POST** `/loyalties/{campaignId}/members/{memberId}/balance`. + # Request Body schema for **POST** `v1/loyalties/members/{memberId}/balance` and **POST** `v1/loyalties/{campaignId}/members/{memberId}/balance`. class LoyaltiesMembersBalanceUpdateRequestBody # Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100 attr_accessor :points @@ -27,7 +27,7 @@ class LoyaltiesMembersBalanceUpdateRequestBody # Reason for the transfer. attr_accessor :reason - # The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. + # The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. attr_accessor :source_id class EnumAttributeValidator @@ -82,28 +82,23 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'expiration_date', + :'reason', + :'source_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersBalanceUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'expiration_type') @@ -128,10 +123,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - invalid_properties end @@ -139,7 +130,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? true end diff --git a/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body.rb index 4d3a8c77..6321accd 100644 --- a/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response schema for **POST** `/loyalties/members/{memberId}/balance` and for **POST** `/loyalties/{campaignId}/members/{memberId}/balance`. + # Response schema for **POST** `v1/loyalties/members/{memberId}/balance` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/balance`. class LoyaltiesMembersBalanceUpdateResponseBody # The incremental points removed or added to the current balance on the loyalty card. attr_accessor :points @@ -28,7 +28,7 @@ class LoyaltiesMembersBalanceUpdateResponseBody # The type of voucher being modified. attr_accessor :type - # The type of object represented by JSON. Default is balance. + # The type of the object represented by JSON. Default is balance. attr_accessor :object attr_accessor :related_object @@ -91,46 +91,38 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'total', + :'balance', + :'type', + :'object', + :'related_object', + :'operation_type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersBalanceUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersBalanceUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'balance') self.balance = attributes[:'balance'] - else - self.balance = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'object') @@ -141,8 +133,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object') self.related_object = attributes[:'related_object'] - else - self.related_object = nil end if attributes.key?(:'operation_type') @@ -155,39 +145,15 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @balance.nil? - invalid_properties.push('invalid value for "balance", balance cannot be nil.') - end - - if @balance < 0 + if !@balance.nil? && @balance < 0 invalid_properties.push('invalid value for "balance", must be greater than or equal to 0.') end - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - pattern = Regexp.new(/balance/) - if @object !~ pattern + if !@object.nil? && @object !~ pattern invalid_properties.push("invalid value for \"object\", must conform to the pattern #{pattern}.") end - if @related_object.nil? - invalid_properties.push('invalid value for "related_object", related_object cannot be nil.') - end - invalid_properties end @@ -195,67 +161,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? - return false if @total.nil? - return false if @balance.nil? - return false if @balance < 0 - return false if @type.nil? + return false if !@balance.nil? && @balance < 0 type_validator = EnumAttributeValidator.new('String', ["loyalty_card", "gift_voucher"]) return false unless type_validator.valid?(@type) - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["balance"]) return false unless object_validator.valid?(@object) - return false if @object !~ Regexp.new(/balance/) - return false if @related_object.nil? + return false if !@object.nil? && @object !~ Regexp.new(/balance/) operation_type_validator = EnumAttributeValidator.new('String', ["MANUAL", "AUTOMATIC"]) return false unless operation_type_validator.valid?(@operation_type) true end - # Custom attribute writer method with validation - # @param [Object] balance Value to be assigned - def balance=(balance) - if balance.nil? - fail ArgumentError, 'balance cannot be nil' - end - - if balance < 0 - fail ArgumentError, 'invalid value for "balance", must be greater than or equal to 0.' - end - - @balance = balance - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["loyalty_card", "gift_voucher"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["balance"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] operation_type Object to be assigned - def operation_type=(operation_type) - validator = EnumAttributeValidator.new('String', ["MANUAL", "AUTOMATIC"]) - unless validator.valid?(operation_type) - fail ArgumentError, "invalid value for \"operation_type\", must be one of #{validator.allowable_values}." - end - @operation_type = operation_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body_related_object.rb b/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body_related_object.rb index eceed339..54171b13 100644 --- a/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body_related_object.rb +++ b/lib/VoucherifySdk/models/loyalties_members_balance_update_response_body_related_object.rb @@ -68,21 +68,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -94,8 +89,6 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end end @@ -104,14 +97,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - invalid_properties end @@ -119,23 +104,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["voucher"]) return false unless type_validator.valid?(@type) - return false if @id.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_create_request_body.rb b/lib/VoucherifySdk/models/loyalties_members_create_request_body.rb new file mode 100644 index 00000000..afd70830 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_create_request_body.rb @@ -0,0 +1,252 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`. + class LoyaltiesMembersCreateRequestBody + # Code of voucher being published. + attr_accessor :voucher + + # The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. + attr_accessor :source_id + + attr_accessor :customer + + # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. + attr_accessor :metadata + + # Specify the distribution channel. + attr_accessor :channel + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'voucher' => :'voucher', + :'source_id' => :'source_id', + :'customer' => :'customer', + :'metadata' => :'metadata', + :'channel' => :'channel' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'voucher' => :'String', + :'source_id' => :'String', + :'customer' => :'Customer', + :'metadata' => :'Object', + :'channel' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'voucher', + :'source_id', + :'metadata', + :'channel' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + voucher == o.voucher && + source_id == o.source_id && + customer == o.customer && + metadata == o.metadata && + channel == o.channel + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [voucher, source_id, customer, metadata, channel].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_create_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_create_response_body.rb new file mode 100644 index 00000000..3cf7e9a4 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_create_response_body.rb @@ -0,0 +1,503 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Respone body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`. + class LoyaltiesMembersCreateResponseBody + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # This is always false for loyalty members. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique identifier of the customer who owns the voucher. + attr_accessor :holder_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Object', + :'gift' => :'Object', + :'loyalty_card' => :'LoyaltiesMembersCreateResponseBodyLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'object' => :'String', + :'publish' => :'LoyaltiesMembersCreateResponseBodyPublish', + :'redemption' => :'LoyaltiesMembersCreateResponseBodyRedemption' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'discount', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'object', + :'publish', + :'redemption' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'LOYALTY_CARD' + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + object == o.object && + publish == o.publish && + redemption == o.redemption + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, object, publish, redemption].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_create_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/loyalties_members_create_response_body_loyalty_card.rb new file mode 100644 index 00000000..4dcfa7a4 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_create_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class LoyaltiesMembersCreateResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_create_response_body_publish.rb b/lib/VoucherifySdk/models/loyalties_members_create_response_body_publish.rb new file mode 100644 index 00000000..a528ab14 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_create_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + class LoyaltiesMembersCreateResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication event counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_create_response_body_redemption.rb b/lib/VoucherifySdk/models/loyalties_members_create_response_body_redemption.rb new file mode 100644 index 00000000..ca623431 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_create_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class LoyaltiesMembersCreateResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_get_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_get_response_body.rb new file mode 100644 index 00000000..2cbd7f12 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_get_response_body.rb @@ -0,0 +1,503 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `/loyalties/{campaignId}/members/{memberId}` and **GET** `/loyalties/members/{memberId}`. + class LoyaltiesMembersGetResponseBody + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # This is always false for loyalty members. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique identifier of the customer who owns the voucher. + attr_accessor :holder_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Object', + :'gift' => :'Object', + :'loyalty_card' => :'LoyaltiesMembersGetResponseBodyLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'object' => :'String', + :'publish' => :'LoyaltiesMembersGetResponseBodyPublish', + :'redemption' => :'LoyaltiesMembersGetResponseBodyRedemption' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'discount', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'object', + :'publish', + :'redemption' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'LOYALTY_CARD' + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + object == o.object && + publish == o.publish && + redemption == o.redemption + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, object, publish, redemption].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_get_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/loyalties_members_get_response_body_loyalty_card.rb new file mode 100644 index 00000000..3b156cfb --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_get_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class LoyaltiesMembersGetResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_get_response_body_publish.rb b/lib/VoucherifySdk/models/loyalties_members_get_response_body_publish.rb new file mode 100644 index 00000000..fca14b0f --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_get_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + class LoyaltiesMembersGetResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication event counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_get_response_body_redemption.rb b/lib/VoucherifySdk/models/loyalties_members_get_response_body_redemption.rb new file mode 100644 index 00000000..ea16fe58 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_get_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class LoyaltiesMembersGetResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body.rb index 8bec69c0..376b9d67 100644 --- a/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/members/{memberId}/points-expiration`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/members/{memberId}/points-expiration`. class LoyaltiesMembersPointsExpirationListResponseBody - # The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. + # The type of the object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,32 +121,16 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - pattern = Regexp.new(/list/) - if @object !~ pattern + if !@object.nil? && @object !~ pattern invalid_properties.push("invalid value for \"object\", must conform to the pattern #{pattern}.") end - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - pattern = Regexp.new(/data/) - if @data_ref !~ pattern + if !@data_ref.nil? && @data_ref !~ pattern invalid_properties.push("invalid value for \"data_ref\", must conform to the pattern #{pattern}.") end - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -161,39 +138,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @object !~ Regexp.new(/list/) - return false if @data_ref.nil? + return false if !@object.nil? && @object !~ Regexp.new(/list/) data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data_ref !~ Regexp.new(/data/) - return false if @data.nil? - return false if @total.nil? + return false if !@data_ref.nil? && @data_ref !~ Regexp.new(/data/) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item.rb b/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item.rb index 7a710538..90bd87f6 100644 --- a/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item.rb +++ b/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item.rb @@ -26,7 +26,7 @@ class LoyaltiesMembersPointsExpirationListResponseBodyDataItem attr_accessor :bucket - # Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format. + # Timestamp representing the date and time when the loyalty points bucket object was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Loyalty points bucket point status. @@ -35,10 +35,10 @@ class LoyaltiesMembersPointsExpirationListResponseBodyDataItem # Date when the number of points defined in the bucket object are due to expire. attr_accessor :expires_at - # Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format. + # Timestamp representing the date and time when the loyalty points bucket object was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the loyalty points bucket. + # The type of the object represented by JSON. This object stores information about the loyalty points bucket. attr_accessor :object class EnumAttributeValidator @@ -107,15 +107,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBodyDataItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBodyDataItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -235,16 +228,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["loyalty_points_bucket"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.rb b/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.rb index 8227c5b8..5ea132d5 100644 --- a/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.rb +++ b/lib/VoucherifySdk/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.rb @@ -47,15 +47,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body.rb index c3b49930..3554217c 100644 --- a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** and `/loyalties/members/{memberId}/redemption`. + # Request body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `v1/loyalties/members/{memberId}/redemption`. class LoyaltiesMembersRedemptionRedeemRequestBody attr_accessor :reward @@ -49,21 +49,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'reward', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body_reward.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body_reward.rb index 5ea4e138..0d285d53 100644 --- a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body_reward.rb +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_request_body_reward.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'points' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBodyReward` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersRedemptionRedeemRequestBodyReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body.rb index 1e99441e..e1fbf6ae 100644 --- a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `/loyalties/members/{memberId}/redemption`. + # Response body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `v1/loyalties/members/{memberId}/redemption`. class LoyaltiesMembersRedemptionRedeemResponseBody # Unique redemption ID. attr_accessor :id - # The type of object represented by the JSON + # The type of the object represented by the JSON attr_accessor :object - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :date # Unique customer ID of the redeeming customer. @@ -34,7 +34,7 @@ class LoyaltiesMembersRedemptionRedeemResponseBody # The metadata object stores all custom attributes assigned to the redemption. attr_accessor :metadata - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. attr_accessor :amount # Unique redemption ID of the parent redemption. @@ -145,60 +145,57 @@ def self.openapi_types :'redemption' => :'String', :'result' => :'String', :'status' => :'String', - :'related_redemptions' => :'RedemptionRelatedRedemptions', + :'related_redemptions' => :'LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions', :'failure_code' => :'String', :'failure_message' => :'String', - :'order' => :'OrderCalculatedNoCustomerData', - :'channel' => :'RedemptionChannel', + :'order' => :'OrderCalculated', + :'channel' => :'LoyaltiesMembersRedemptionRedeemResponseBodyChannel', :'customer' => :'SimpleCustomer', :'related_object_type' => :'String', :'related_object_id' => :'String', - :'voucher' => :'Voucher', + :'voucher' => :'LoyaltiesMembersRedemptionRedeemResponseBodyVoucher', :'promotion_tier' => :'PromotionTier', :'reward' => :'RedemptionRewardResult', - :'gift' => :'RedemptionGift', - :'loyalty_card' => :'RedemptionLoyaltyCard' + :'gift' => :'LoyaltiesMembersRedemptionRedeemResponseBodyGift', + :'loyalty_card' => :'LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'date', :'customer_id', :'tracking_id', :'metadata', + :'amount', :'redemption', - :'order', - :'customer', + :'result', + :'status', + :'related_redemptions', + :'failure_code', + :'failure_message', + :'channel', + :'related_object_type', + :'related_object_id', + :'voucher', + :'gift', + :'loyalty_card' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Redemption' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersRedemptionRedeemResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -209,26 +206,18 @@ def initialize(attributes = {}) if attributes.key?(:'date') self.date = attributes[:'date'] - else - self.date = nil end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil end if attributes.key?(:'tracking_id') self.tracking_id = attributes[:'tracking_id'] - else - self.tracking_id = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'amount') @@ -237,20 +226,14 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] - else - self.redemption = nil end if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'status') self.status = attributes[:'status'] - else - self.status = nil end if attributes.key?(:'related_redemptions') @@ -267,32 +250,22 @@ def initialize(attributes = {}) if attributes.key?(:'order') self.order = attributes[:'order'] - else - self.order = nil end if attributes.key?(:'channel') self.channel = attributes[:'channel'] - else - self.channel = nil end if attributes.key?(:'customer') self.customer = attributes[:'customer'] - else - self.customer = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'voucher') @@ -305,8 +278,6 @@ def initialize(attributes = {}) if attributes.key?(:'reward') self.reward = attributes[:'reward'] - else - self.reward = nil end if attributes.key?(:'gift') @@ -323,42 +294,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @date.nil? - invalid_properties.push('invalid value for "date", date cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @reward.nil? - invalid_properties.push('invalid value for "reward", reward cannot be nil.') - end - invalid_properties end @@ -366,66 +301,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["redemption"]) return false unless object_validator.valid?(@object) - return false if @date.nil? - return false if @result.nil? result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) return false unless result_validator.valid?(@result) - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) return false unless status_validator.valid?(@status) - return false if @channel.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) return false unless related_object_type_validator.valid?(@related_object_type) - return false if @related_object_id.nil? - return false if @reward.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["redemption"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_channel.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_channel.rb new file mode 100644 index 00000000..9fad0f28 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_channel.rb @@ -0,0 +1,245 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the details of the channel through which the redemption was issued. + class LoyaltiesMembersRedemptionRedeemResponseBodyChannel + # 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. + attr_accessor :channel_id + + # The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + attr_accessor :channel_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_type' => :'channel_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'channel_id', + :'channel_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_type') + self.channel_type = attributes[:'channel_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) + return false unless channel_type_validator.valid?(@channel_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_type == o.channel_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [channel_id, channel_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_gift.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_gift.rb new file mode 100644 index 00000000..7e1284e6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the amount subtracted from the gift card for the redemption. + class LoyaltiesMembersRedemptionRedeemResponseBodyGift + # Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_loyalty_card.rb new file mode 100644 index 00000000..af504a98 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_loyalty_card.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the number of points subtracted from the loyalty card for the redemption. + class LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard + # Number of points subtracted from the loyalty card as a result of the redemption. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions.rb new file mode 100644 index 00000000..708df8f7 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions.rb @@ -0,0 +1,222 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions + attr_accessor :rollbacks + + attr_accessor :redemptions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rollbacks' => :'rollbacks', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rollbacks' => :'Array', + :'redemptions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'rollbacks', + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'rollbacks') + if (value = attributes[:'rollbacks']).is_a?(Array) + self.rollbacks = value + end + end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Array) + self.redemptions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rollbacks == o.rollbacks && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rollbacks, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..250c0174 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item.rb new file mode 100644 index 00000000..a2bca2d3 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem + # Unique rollback redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher.rb new file mode 100644 index 00000000..61b3eafb --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher.rb @@ -0,0 +1,542 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the details of the voucher being redeemed. + class LoyaltiesMembersRedemptionRedeemResponseBodyVoucher + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + attr_accessor :holder + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'holder' => :'holder' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift', + :'loyalty_card' => :'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish', + :'redemption' => :'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'holder' => :'SimpleCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'holder') + self.holder = attributes[:'holder'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments && + holder == o.holder + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments, holder].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_gift.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_gift.rb new file mode 100644 index 00000000..f714aa05 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.rb new file mode 100644 index 00000000..ea9d1128 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_publish.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_publish.rb new file mode 100644 index 00000000..53c5afec --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_redemption.rb b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_redemption.rb new file mode 100644 index 00000000..a895ed49 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body.rb index f31c6b0d..f2209dc0 100644 --- a/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/members/{memberId}/rewards` + # Response body schema for **GET** `v1/loyalties/members/{memberId}/rewards` class LoyaltiesMembersRewardsListResponseBody - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Identifies the name of the attribute that contains the array of loyalty reward objects. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersRewardsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersRewardsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,23 +121,7 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @total < 0 + if !@total.nil? && @total < 0 invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') end @@ -155,52 +132,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? - return false if @total < 0 + return false if !@total.nil? && @total < 0 true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - - # Custom attribute writer method with validation - # @param [Object] total Value to be assigned - def total=(total) - if total.nil? - fail ArgumentError, 'total cannot be nil' - end - - if total < 0 - fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' - end - - @total = total - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body_data_item.rb b/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body_data_item.rb index 73d868b4..6f180d47 100644 --- a/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body_data_item.rb +++ b/lib/VoucherifySdk/models/loyalties_members_rewards_list_response_body_data_item.rb @@ -19,7 +19,7 @@ class LoyaltiesMembersRewardsListResponseBodyDataItem attr_accessor :assignment - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object class EnumAttributeValidator @@ -76,15 +76,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersRewardsListResponseBodyDataItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersRewardsListResponseBodyDataItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -120,16 +113,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["loyalty_reward"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_tiers_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_tiers_list_response_body.rb index d1d74b84..e78155b8 100644 --- a/lib/VoucherifySdk/models/loyalties_members_tiers_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_tiers_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/members/{memberId}/tiers`. + # Response body schema for **GET** `v1/loyalties/members/{memberId}/tiers`. class LoyaltiesMembersTiersListResponseBody - # The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary. + # The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of loyalty tier objects. @@ -77,21 +77,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTiersListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTiersListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -111,14 +108,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -127,22 +120,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -150,37 +127,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body.rb b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body.rb index d75192e7..f4af67c7 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/loyalties/members/{memberId}/transactions/export` and for **POST** `/loyalties/{campaignId}/members/{memberId}/transactions/export`. + # Request body schema for **POST** `v1/loyalties/members/{memberId}/transactions/export` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transactions/export`. class LoyaltiesMembersTransactionsExportCreateRequestBody attr_accessor :parameters @@ -40,21 +40,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'parameters' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body_parameters.rb index f2bcea84..68f5f4ee 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body_parameters.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_request_body_parameters.rb @@ -71,21 +71,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'fields', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBodyParameters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransactionsExportCreateRequestBodyParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body.rb index e52c658f..f0619485 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/loyalties/members/{memberId}/transactions/export` and for **POST** `/loyalties/{campaignId}/members/{memberId}/transactions/export`. + # Response body schema for **POST** `v1/loyalties/members/{memberId}/transactions/export` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transactions/export`. class LoyaltiesMembersTransactionsExportCreateResponseBody # Unique export ID. attr_accessor :id @@ -95,43 +95,35 @@ def self.openapi_types :'result' => :'Object', :'user_id' => :'String', :'exported_object' => :'String', - :'parameters' => :'LoyaltiesMembersTransactionsExportCreateRequestBodyParameters' + :'parameters' => :'LoyaltiesMembersTransactionsExportCreateResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', :'result', + :'user_id', + :'exported_object', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportVoucherTransactionsScheduled' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransactionsExportCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransactionsExportCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -142,8 +134,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'status') @@ -158,14 +148,10 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] - else - self.user_id = nil end if attributes.key?(:'exported_object') @@ -184,30 +170,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - invalid_properties end @@ -215,51 +177,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["export"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) return false unless exported_object_validator.valid?(@exported_object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body_parameters.rb new file mode 100644 index 00000000..4ca4d906 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_members_transactions_export_create_response_body_parameters.rb @@ -0,0 +1,252 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + class LoyaltiesMembersTransactionsExportCreateResponseBodyParameters + attr_accessor :order + + # Array of strings containing the data in the export. These fields define the headers in the CSV file. + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'ExportVoucherTransactionsOrder', + :'fields' => :'Array', + :'filters' => :'ExportVoucherTransactionsFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'fields', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_members_transactions_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_transactions_list_response_body.rb index d69d19a2..38c9c9eb 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transactions_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transactions_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/members/{memberId}/transactions` and `/loyalties/members/{memberId}/transactions`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/members/{memberId}/transactions` and `/loyalties/members/{memberId}/transactions`. class LoyaltiesMembersTransactionsListResponseBody - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Identifies the name of the attribute that contains the array of transaction objects. @@ -25,7 +25,7 @@ class LoyaltiesMembersTransactionsListResponseBody # A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. attr_accessor :data - # As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. + # As query results are always limited (by the limit parameter), the has_more flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. attr_accessor :has_more class EnumAttributeValidator @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'has_more' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransactionsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransactionsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'has_more') self.has_more = attributes[:'has_more'] - else - self.has_more = nil end end @@ -128,32 +121,16 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - pattern = Regexp.new(/list/) - if @object !~ pattern + if !@object.nil? && @object !~ pattern invalid_properties.push("invalid value for \"object\", must conform to the pattern #{pattern}.") end - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - pattern = Regexp.new(/data/) - if @data_ref !~ pattern + if !@data_ref.nil? && @data_ref !~ pattern invalid_properties.push("invalid value for \"data_ref\", must conform to the pattern #{pattern}.") end - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @has_more.nil? - invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') - end - invalid_properties end @@ -161,39 +138,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @object !~ Regexp.new(/list/) - return false if @data_ref.nil? + return false if !@object.nil? && @object !~ Regexp.new(/list/) data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data_ref !~ Regexp.new(/data/) - return false if @data.nil? - return false if @has_more.nil? + return false if !@data_ref.nil? && @data_ref !~ Regexp.new(/data/) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body.rb index e6ffaac0..c3c8a0ef 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/loyalties/{campaignId}/members/{memberId}/transfers`. + # Response body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transfers`. class LoyaltiesMembersTransfersCreateResponseBody # Assigned by the Voucherify API, identifies the voucher. attr_accessor :id @@ -52,6 +52,8 @@ class LoyaltiesMembersTransfersCreateResponseBody # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + attr_accessor :publish attr_accessor :redemption @@ -70,7 +72,7 @@ class LoyaltiesMembersTransfersCreateResponseBody # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Unique customer ID of voucher owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. @@ -116,6 +118,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'publish' => :'publish', :'redemption' => :'redemption', :'active' => :'active', @@ -148,8 +151,9 @@ def self.openapi_types :'loyalty_card' => :'LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'publish' => :'LoyaltiesMembersTransfersCreateResponseBodyPublish', :'redemption' => :'LoyaltiesMembersTransfersCreateResponseBodyRedemption', :'active' => :'String', @@ -166,41 +170,44 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', :'category', :'category_id', + :'categories', + :'type', + :'loyalty_card', :'start_date', :'expiration_date', - :'validity_timeframe', - :'validity_day_of_week', + :'publish', + :'redemption', + :'active', :'additional_info', + :'metadata', + :'assets', + :'is_referral_code', + :'holder_id', + :'updated_at', + :'created_at' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end if attributes.key?(:'campaign') @@ -213,14 +220,10 @@ def initialize(attributes = {}) if attributes.key?(:'category') self.category = attributes[:'category'] - else - self.category = nil end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') @@ -237,20 +240,14 @@ def initialize(attributes = {}) if attributes.key?(:'loyalty_card') self.loyalty_card = attributes[:'loyalty_card'] - else - self.loyalty_card = nil end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] - else - self.start_date = nil end if attributes.key?(:'expiration_date') self.expiration_date = attributes[:'expiration_date'] - else - self.expiration_date = nil end if attributes.key?(:'validity_timeframe') @@ -267,6 +264,10 @@ def initialize(attributes = {}) self.validity_day_of_week = nil end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'publish') self.publish = attributes[:'publish'] end @@ -277,20 +278,14 @@ def initialize(attributes = {}) if attributes.key?(:'active') self.active = attributes[:'active'] - else - self.active = nil end if attributes.key?(:'additional_info') self.additional_info = attributes[:'additional_info'] - else - self.additional_info = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'assets') @@ -299,8 +294,6 @@ def initialize(attributes = {}) if attributes.key?(:'is_referral_code') self.is_referral_code = attributes[:'is_referral_code'] - else - self.is_referral_code = nil end if attributes.key?(:'holder_id') @@ -313,8 +306,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end end @@ -323,36 +314,12 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @loyalty_card.nil? - invalid_properties.push('invalid value for "loyalty_card", loyalty_card cannot be nil.') - end - - if @active.nil? - invalid_properties.push('invalid value for "active", active cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @is_referral_code.nil? - invalid_properties.push('invalid value for "is_referral_code", is_referral_code cannot be nil.') + if @validity_timeframe.nil? + invalid_properties.push('invalid value for "validity_timeframe", validity_timeframe cannot be nil.') end - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + if @validity_day_of_week.nil? + invalid_properties.push('invalid value for "validity_day_of_week", validity_day_of_week cannot be nil.') end invalid_properties @@ -362,29 +329,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @code.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) return false unless type_validator.valid?(@type) - return false if @loyalty_card.nil? - return false if @active.nil? - return false if @metadata.nil? - return false if @is_referral_code.nil? - return false if @created_at.nil? + return false if @validity_timeframe.nil? + return false if @validity_day_of_week.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -403,6 +354,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && publish == o.publish && redemption == o.redemption && active == o.active && @@ -424,7 +376,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, publish, redemption, active, additional_info, metadata, assets, is_referral_code, holder_id, updated_at, created_at].hash + [id, code, campaign, campaign_id, category, category_id, categories, type, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, publish, redemption, active, additional_info, metadata, assets, is_referral_code, holder_id, updated_at, created_at].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets.rb index 27f53cf4..287cc9ee 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets.rb @@ -44,21 +44,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'qr', + :'barcode' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssets` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_barcode.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_barcode.rb index 499cd689..bce8e654 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_barcode.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_barcode.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_qr.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_qr.rb index e5384b14..75e5a1cf 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_qr.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_assets_qr.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssetsQr` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyAssetsQr`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card.rb index ed622798..699552a0 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card.rb @@ -16,7 +16,7 @@ module VoucherifySdk # Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD. class LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard - # Total points incurred over lifespan of loyalty card. + # Total points incurred over the lifespan of the loyalty card. attr_accessor :points # Points available for reward redemption. @@ -56,34 +56,27 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'balance') self.balance = attributes[:'balance'] - else - self.balance = nil end if attributes.key?(:'next_expiration_date') @@ -100,14 +93,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @balance.nil? - invalid_properties.push('invalid value for "balance", balance cannot be nil.') - end - invalid_properties end @@ -115,8 +100,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? - return false if @balance.nil? true end diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_publish.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_publish.rb index 32ce8286..3758e4a8 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_publish.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_publish.rb @@ -16,7 +16,7 @@ module VoucherifySdk # This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. class LoyaltiesMembersTransfersCreateResponseBodyPublish - # The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. + # The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. attr_accessor :object # Publication events counter. @@ -77,21 +77,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'count', + :'entries', + :'url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyPublish` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyPublish`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -121,10 +118,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -132,22 +125,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_redemption.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_redemption.rb index eae2736b..9dc383f6 100644 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_redemption.rb +++ b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_redemption.rb @@ -25,9 +25,7 @@ class LoyaltiesMembersTransfersCreateResponseBodyRedemption # How many times a voucher has already been redeemed. attr_accessor :redeemed_quantity - attr_accessor :redemption_entries - - # The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. + # The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. attr_accessor :object # The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions @@ -61,7 +59,6 @@ def self.attribute_map :'quantity' => :'quantity', :'redeemed_points' => :'redeemed_points', :'redeemed_quantity' => :'redeemed_quantity', - :'redemption_entries' => :'redemption_entries', :'object' => :'object', :'url' => :'url' } @@ -78,7 +75,6 @@ def self.openapi_types :'quantity' => :'Integer', :'redeemed_points' => :'Integer', :'redeemed_quantity' => :'Integer', - :'redemption_entries' => :'Array', :'object' => :'String', :'url' => :'String' } @@ -88,28 +84,23 @@ def self.openapi_types def self.openapi_nullable Set.new([ :'quantity', + :'redeemed_points', + :'redeemed_quantity', + :'object', + :'url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyRedemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] - else - self.quantity = nil end if attributes.key?(:'redeemed_points') @@ -120,12 +111,6 @@ def initialize(attributes = {}) self.redeemed_quantity = attributes[:'redeemed_quantity'] end - if attributes.key?(:'redemption_entries') - if (value = attributes[:'redemption_entries']).is_a?(Array) - self.redemption_entries = value - end - end - if attributes.key?(:'object') self.object = attributes[:'object'] else @@ -154,16 +139,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -172,7 +147,6 @@ def ==(o) quantity == o.quantity && redeemed_points == o.redeemed_points && redeemed_quantity == o.redeemed_quantity && - redemption_entries == o.redemption_entries && object == o.object && url == o.url end @@ -186,7 +160,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [quantity, redeemed_points, redeemed_quantity, redemption_entries, object, url].hash + [quantity, redeemed_points, redeemed_quantity, object, url].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_validity_timeframe.rb b/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_validity_timeframe.rb deleted file mode 100644 index 759111c2..00000000 --- a/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_validity_timeframe.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe. - class LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe - # Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour. - attr_accessor :interval - - # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day. - attr_accessor :duration - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'interval' => :'interval', - :'duration' => :'duration' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'interval' => :'String', - :'duration' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesMembersTransfersCreateResponseBodyValidityTimeframe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'interval') - self.interval = attributes[:'interval'] - end - - if attributes.key?(:'duration') - self.duration = attributes[:'duration'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - interval == o.interval && - duration == o.duration - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [interval, duration].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body.rb new file mode 100644 index 00000000..d4709b00 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request schema model for validating a voucher using **POST** `/v1/loyalties/{campaignId}/points-expiration/export` + class LoyaltiesPointsExpirationExportCreateRequestBody + attr_accessor :parameters + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'parameters' => :'LoyaltiesPointsExpirationExportCreateRequestBodyParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters.rb new file mode 100644 index 00000000..1408e072 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # List of fields and filters that will be used to create the export. + class LoyaltiesPointsExpirationExportCreateRequestBodyParameters + # How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. + attr_accessor :order + + # Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'String', + :'fields' => :'Array', + :'filters' => :'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order', + :'fields', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + order_validator = EnumAttributeValidator.new('String', ["expires_at", "-expires_at"]) + return false unless order_validator.valid?(@order) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters.rb new file mode 100644 index 00000000..8294f810 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters.rb @@ -0,0 +1,250 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the export. + class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters + attr_accessor :junction + + attr_accessor :voucher_id + + attr_accessor :campaign_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'voucher_id' => :'voucher_id', + :'campaign_id' => :'campaign_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'voucher_id' => :'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId', + :'campaign_id' => :'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'voucher_id', + :'campaign_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + + if attributes.key?(:'voucher_id') + self.voucher_id = attributes[:'voucher_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + voucher_id == o.voucher_id && + campaign_id == o.campaign_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, voucher_id, campaign_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id.rb new file mode 100644 index 00000000..0775f21f --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId + attr_accessor :conditions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions.rb new file mode 100644 index 00000000..789839e3 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions.rb @@ -0,0 +1,247 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions + # Array of the resource values that should be included in the results. + attr_accessor :_in + + # Array of the resource values that should be included in the results. + attr_accessor :not_in + + # Specify the exact resource value. + attr_accessor :is + + # Results should omit this value. + attr_accessor :is_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id.rb new file mode 100644 index 00000000..3e460fcf --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId + attr_accessor :conditions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions.rb new file mode 100644 index 00000000..a9e803d1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions.rb @@ -0,0 +1,247 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions + # Array of the resource values that should be included in the results. + attr_accessor :_in + + # Array of the resource values that should be included in the results. + attr_accessor :not_in + + # Specify the exact resource value. + attr_accessor :is + + # Results should omit this value. + attr_accessor :is_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body.rb new file mode 100644 index 00000000..e77908fd --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body.rb @@ -0,0 +1,332 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing an export of points expirations. + class LoyaltiesPointsExpirationExportCreateResponseBody + # Unique export ID. + attr_accessor :id + + # The type of object being represented. This object stores information about the export. + attr_accessor :object + + # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + attr_accessor :created_at + + # Status of the export. Informs you whether the export has already been completed. + attr_accessor :status + + # The channel through which the export was triggered. + attr_accessor :channel + + # The type of exported object. + attr_accessor :exported_object + + attr_accessor :parameters + + # Always null. + attr_accessor :result + + # `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard. `user_id` is returned when the channel value is `WEBSITE`. + attr_accessor :user_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'status' => :'status', + :'channel' => :'channel', + :'exported_object' => :'exported_object', + :'parameters' => :'parameters', + :'result' => :'result', + :'user_id' => :'user_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'channel' => :'String', + :'exported_object' => :'String', + :'parameters' => :'LoyaltiesPointsExpirationExportCreateResponseBodyParameters', + :'result' => :'Object', + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', + :'exported_object', + :'result', + :'user_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'export' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 'SCHEDULED' + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'exported_object') + self.exported_object = attributes[:'exported_object'] + else + self.exported_object = 'points_expiration' + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["export"]) + return false unless object_validator.valid?(@object) + status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) + return false unless status_validator.valid?(@status) + channel_validator = EnumAttributeValidator.new('String', ["API", "WEBSITE"]) + return false unless channel_validator.valid?(@channel) + exported_object_validator = EnumAttributeValidator.new('String', ["points_expiration"]) + return false unless exported_object_validator.valid?(@exported_object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + status == o.status && + channel == o.channel && + exported_object == o.exported_object && + parameters == o.parameters && + result == o.result && + user_id == o.user_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, status, channel, exported_object, parameters, result, user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters.rb new file mode 100644 index 00000000..626a18e4 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # List of fields and filters that were passed in the request body to create the export. + class LoyaltiesPointsExpirationExportCreateResponseBodyParameters + # How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. + attr_accessor :order + + # Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | + attr_accessor :fields + + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'String', + :'fields' => :'Array', + :'filters' => :'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order', + :'fields', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + order_validator = EnumAttributeValidator.new('String', ["expires_at", "-expires_at"]) + return false unless order_validator.valid?(@order) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters.rb new file mode 100644 index 00000000..702a9547 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters.rb @@ -0,0 +1,250 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the export. + class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters + attr_accessor :junction + + attr_accessor :voucher_id + + attr_accessor :campaign_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'voucher_id' => :'voucher_id', + :'campaign_id' => :'campaign_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'voucher_id' => :'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId', + :'campaign_id' => :'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'voucher_id', + :'campaign_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + + if attributes.key?(:'voucher_id') + self.voucher_id = attributes[:'voucher_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + voucher_id == o.voucher_id && + campaign_id == o.campaign_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, voucher_id, campaign_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id.rb new file mode 100644 index 00000000..3983b67c --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId + attr_accessor :conditions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions.rb new file mode 100644 index 00000000..22488820 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions.rb @@ -0,0 +1,247 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions + # Array of the resource values that should be included in the results. + attr_accessor :_in + + # Array of the resource values that should be included in the results. + attr_accessor :not_in + + # Specify the exact resource value. + attr_accessor :is + + # Results should omit this value. + attr_accessor :is_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id.rb new file mode 100644 index 00000000..80cfc44a --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId + attr_accessor :conditions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions.rb b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions.rb new file mode 100644 index 00000000..d1f4c63b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions.rb @@ -0,0 +1,247 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions + # Array of the resource values that should be included in the results. + attr_accessor :_in + + # Array of the resource values that should be excluded from the results. + attr_accessor :not_in + + # Specify the exact resource value. + attr_accessor :is + + # Results should omit this value. + attr_accessor :is_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body.rb b/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body.rb index 7fa85317..a8f2f564 100644 --- a/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/reward-assignments/{assignmentId}`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments/{assignmentId}`. class LoyaltiesRewardAssignmentsGetResponseBody # Unique reward assignment ID, assigned by Voucherify. attr_accessor :id @@ -22,13 +22,13 @@ class LoyaltiesRewardAssignmentsGetResponseBody # Associated reward ID. attr_accessor :reward_id - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward assignment. + # The type of the object represented by the JSON. This object stores information about the reward assignment. attr_accessor :object # Related object ID to which the reward was assigned. @@ -90,61 +90,46 @@ def self.openapi_types :'object' => :'String', :'related_object_id' => :'String', :'related_object_type' => :'String', - :'parameters' => :'RewardAssignmentParametersParameters' + :'parameters' => :'LoyaltiesRewardAssignmentsGetResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'reward_id', + :'created_at', :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RewardAssignment' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesRewardAssignmentsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'reward_id') self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -155,8 +140,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') @@ -175,30 +158,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - invalid_properties end @@ -206,39 +165,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) return false unless related_object_type_validator.valid?(@related_object_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters.rb new file mode 100644 index 00000000..a257698b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class LoyaltiesRewardAssignmentsGetResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..60438379 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_reward_assignments_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_reward_assignments_list_response_body.rb new file mode 100644 index 00000000..8a21a2f9 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_reward_assignments_list_response_body.rb @@ -0,0 +1,273 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments`. + class LoyaltiesRewardAssignmentsListResponseBody + # The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of reward assignment objects. + attr_accessor :data_ref + + # Contains array of reward assignment objects. + attr_accessor :data + + # Total number of reward assignment objects. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body.rb b/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body.rb index 224a170b..dc2ea978 100644 --- a/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward` + # Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward` class LoyaltiesRewardAssignmentsRewardGetResponseBody # Unique reward ID, assigned by Voucherify. attr_accessor :id @@ -38,13 +38,13 @@ class LoyaltiesRewardAssignmentsRewardGetResponseBody attr_accessor :parameters - # Timestamp representing the date and time when the reward was created in ISO 8601 format. + # Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward. + # The type of the object represented by the JSON. This object stores information about the reward. attr_accessor :object class EnumAttributeValidator @@ -98,7 +98,7 @@ def self.openapi_types :'name' => :'String', :'stock' => :'Integer', :'redeemed' => :'Integer', - :'attributes' => :'RewardAttributes', + :'attributes' => :'LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes', :'metadata' => :'Object', :'type' => :'String', :'parameters' => :'RewardType', @@ -111,56 +111,40 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', :'stock', :'redeemed', + :'attributes', + :'metadata', + :'type', + :'created_at', :'updated_at', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Reward' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesRewardAssignmentsRewardGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesRewardAssignmentsRewardGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'stock') self.stock = attributes[:'stock'] - else - self.stock = nil end if attributes.key?(:'redeemed') self.redeemed = attributes[:'redeemed'] - else - self.redeemed = nil end if attributes.key?(:'attributes') @@ -169,14 +153,10 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'parameters') @@ -185,14 +165,10 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -207,26 +183,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end @@ -238,39 +194,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @metadata.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) return false unless type_validator.valid?(@type) - return false if @created_at.nil? return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body_attributes.rb b/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body_attributes.rb new file mode 100644 index 00000000..80eeeedc --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body_attributes.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # These properties are configurable for **material rewards**. + class LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes + # The HTTPS URL pointing to the .png or .jpg file. + attr_accessor :image_url + + # An arbitrary string that you can attach to a material reward. + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'image_url', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'description' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body.rb b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body.rb new file mode 100644 index 00000000..6ae5c12c --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body.rb @@ -0,0 +1,231 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesRewardsCreateAssignmentItemRequestBody + # The ID of the reward that will be assigned to the campaign. + attr_accessor :reward + + attr_accessor :parameters + + attr_accessor :validation_rules + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reward' => :'reward', + :'parameters' => :'parameters', + :'validation_rules' => :'validation_rules' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reward' => :'String', + :'parameters' => :'LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters', + :'validation_rules' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'reward', + :'parameters', + :'validation_rules' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'validation_rules') + if (value = attributes[:'validation_rules']).is_a?(Array) + self.validation_rules = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reward == o.reward && + parameters == o.parameters && + validation_rules == o.validation_rules + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reward, parameters, validation_rules].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters.rb new file mode 100644 index 00000000..9ea53047 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty.rb new file mode 100644 index 00000000..eafe32ec --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty + # Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body.rb b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body.rb new file mode 100644 index 00000000..f977f11b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body.rb @@ -0,0 +1,316 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/v1/loyalties/{campaignId}/rewards`. + class LoyaltiesRewardsCreateAssignmentResponseBody + # Unique reward assignment ID, assigned by Voucherify. + attr_accessor :id + + # Associated reward ID. + attr_accessor :reward_id + + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # The type of the object represented by the JSON. This object stores information about the reward assignment. + attr_accessor :object + + # Related object ID to which the reward was assigned. + attr_accessor :related_object_id + + # Related object type to which the reward was assigned. + attr_accessor :related_object_type + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'reward_id' => :'reward_id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'object' => :'object', + :'related_object_id' => :'related_object_id', + :'related_object_type' => :'related_object_type', + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'reward_id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'object' => :'String', + :'related_object_id' => :'String', + :'related_object_type' => :'String', + :'parameters' => :'LoyaltiesRewardsCreateAssignmentResponseBodyParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'reward_id', + :'created_at', + :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'reward_id') + self.reward_id = attributes[:'reward_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'reward_assignment' + end + + if attributes.key?(:'related_object_id') + self.related_object_id = attributes[:'related_object_id'] + end + + if attributes.key?(:'related_object_type') + self.related_object_type = attributes[:'related_object_type'] + else + self.related_object_type = 'campaign' + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) + return false unless object_validator.valid?(@object) + related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless related_object_type_validator.valid?(@related_object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + reward_id == o.reward_id && + created_at == o.created_at && + updated_at == o.updated_at && + object == o.object && + related_object_id == o.related_object_id && + related_object_type == o.related_object_type && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, reward_id, created_at, updated_at, object, related_object_id, related_object_type, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters.rb new file mode 100644 index 00000000..75c27330 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class LoyaltiesRewardsCreateAssignmentResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..8b8a84f0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_get_response_body.rb b/lib/VoucherifySdk/models/loyalties_rewards_get_response_body.rb index bc4770b4..dfaeba08 100644 --- a/lib/VoucherifySdk/models/loyalties_rewards_get_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_rewards_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/rewards/{assignmentId}` + # Response body schema for **GET** `v1/loyalties/{campaignId}/rewards/{assignmentId}` class LoyaltiesRewardsGetResponseBody # Unique reward assignment ID, assigned by Voucherify. attr_accessor :id @@ -22,13 +22,13 @@ class LoyaltiesRewardsGetResponseBody # Associated reward ID. attr_accessor :reward_id - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward assignment. + # The type of the object represented by the JSON. This object stores information about the reward assignment. attr_accessor :object # Related object ID to which the reward was assigned. @@ -90,61 +90,46 @@ def self.openapi_types :'object' => :'String', :'related_object_id' => :'String', :'related_object_type' => :'String', - :'parameters' => :'RewardAssignmentParametersParameters' + :'parameters' => :'LoyaltiesRewardsGetResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'reward_id', + :'created_at', :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RewardAssignment' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesRewardsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesRewardsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'reward_id') self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -155,8 +140,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') @@ -175,30 +158,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - invalid_properties end @@ -206,39 +165,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) return false unless related_object_type_validator.valid?(@related_object_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters.rb new file mode 100644 index 00000000..756f7d42 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class LoyaltiesRewardsGetResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'LoyaltiesRewardsGetResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..560212be --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class LoyaltiesRewardsGetResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_list_assignments_response_body.rb b/lib/VoucherifySdk/models/loyalties_rewards_list_assignments_response_body.rb new file mode 100644 index 00000000..1dae45d0 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_list_assignments_response_body.rb @@ -0,0 +1,273 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/loyalties/{campaignId}/rewards`. + class LoyaltiesRewardsListAssignmentsResponseBody + # The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of reward assignment objects. + attr_accessor :data_ref + + # Contains array of reward assignment objects. + attr_accessor :data + + # Total number of reward assignment objects. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body.rb b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body.rb new file mode 100644 index 00000000..afcffa20 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `v1/v1/loyalties/{campaignId}/rewards/{assignmentId}`. + class LoyaltiesRewardsUpdateAssignmentRequestBody + attr_accessor :parameters + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'parameters' => :'LoyaltiesRewardsUpdateAssignmentRequestBodyParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'parameters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters.rb new file mode 100644 index 00000000..24dee52f --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # An object that defines the price of the reward in loyalty points. + class LoyaltiesRewardsUpdateAssignmentRequestBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.rb new file mode 100644 index 00000000..c3a0104c --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores the points parameter. + class LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty + # Defines how many points are required to obtain the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body.rb b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body.rb new file mode 100644 index 00000000..82f731d6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body.rb @@ -0,0 +1,316 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `v1/v1/loyalties/{campaignId}/rewards/{assignmentId}`. + class LoyaltiesRewardsUpdateAssignmentResponseBody + # Unique reward assignment ID, assigned by Voucherify. + attr_accessor :id + + # Associated reward ID. + attr_accessor :reward_id + + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # The type of the object represented by the JSON. This object stores information about the reward assignment. + attr_accessor :object + + # Related object ID to which the reward was assigned. + attr_accessor :related_object_id + + # Related object type to which the reward was assigned. + attr_accessor :related_object_type + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'reward_id' => :'reward_id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'object' => :'object', + :'related_object_id' => :'related_object_id', + :'related_object_type' => :'related_object_type', + :'parameters' => :'parameters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'reward_id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'object' => :'String', + :'related_object_id' => :'String', + :'related_object_type' => :'String', + :'parameters' => :'LoyaltiesRewardsUpdateAssignmentResponseBodyParameters' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'reward_id', + :'created_at', + :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'reward_id') + self.reward_id = attributes[:'reward_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'reward_assignment' + end + + if attributes.key?(:'related_object_id') + self.related_object_id = attributes[:'related_object_id'] + end + + if attributes.key?(:'related_object_type') + self.related_object_type = attributes[:'related_object_type'] + else + self.related_object_type = 'campaign' + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) + return false unless object_validator.valid?(@object) + related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) + return false unless related_object_type_validator.valid?(@related_object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + reward_id == o.reward_id && + created_at == o.created_at && + updated_at == o.updated_at && + object == o.object && + related_object_id == o.related_object_id && + related_object_type == o.related_object_type && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, reward_id, created_at, updated_at, object, related_object_id, related_object_type, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters.rb b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters.rb new file mode 100644 index 00000000..976e6d06 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class LoyaltiesRewardsUpdateAssignmentResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..2eadce3b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_tiers_create_in_bulk_request_body_item.rb b/lib/VoucherifySdk/models/loyalties_tiers_create_in_bulk_request_body_item.rb index de38df03..d7704f7e 100644 --- a/lib/VoucherifySdk/models/loyalties_tiers_create_in_bulk_request_body_item.rb +++ b/lib/VoucherifySdk/models/loyalties_tiers_create_in_bulk_request_body_item.rb @@ -59,6 +59,10 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'earning_rules', + :'rewards', + :'points', ]) end @@ -72,22 +76,13 @@ def self.openapi_all_of # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesTiersCreateInBulkRequestBodyItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesTiersCreateInBulkRequestBodyItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'earning_rules') @@ -104,8 +99,6 @@ def initialize(attributes = {}) if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'metadata') @@ -118,14 +111,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - invalid_properties end @@ -133,8 +118,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @points.nil? true end diff --git a/lib/VoucherifySdk/models/loyalties_tiers_earning_rules_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_tiers_earning_rules_list_response_body.rb index 3c5285bf..054c83af 100644 --- a/lib/VoucherifySdk/models/loyalties_tiers_earning_rules_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_tiers_earning_rules_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules`. class LoyaltiesTiersEarningRulesListResponseBody - # The type of object represented by JSON. This object stores information about earning rules in a dictionary. + # The type of the object represented by JSON. This object stores information about earning rules in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of earning rule objects. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesTiersEarningRulesListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesTiersEarningRulesListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,22 +121,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -151,37 +128,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_tiers_get_response_body.rb b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body.rb index 7d0b4d89..cc5eff8f 100644 --- a/lib/VoucherifySdk/models/loyalties_tiers_get_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/tiers/{loyaltyTierId}`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}`. class LoyaltiesTiersGetResponseBody # Loyalty Tier name. attr_accessor :name @@ -36,17 +36,17 @@ class LoyaltiesTiersGetResponseBody # The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format. + # Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at attr_accessor :config attr_accessor :expiration - # The type of object represented by JSON. This object stores information about the loyalty. + # The type of the object represented by JSON. This object stores information about the loyalty. attr_accessor :object class EnumAttributeValidator @@ -100,13 +100,13 @@ def self.openapi_types :'name' => :'String', :'earning_rules' => :'Hash', :'rewards' => :'Hash', - :'points' => :'LoyaltyTierBasePoints', + :'points' => :'LoyaltiesTiersGetResponseBodyPoints', :'id' => :'String', :'campaign_id' => :'String', :'metadata' => :'Object', :'created_at' => :'Time', :'updated_at' => :'Time', - :'config' => :'LoyaltyTierAllOfConfig', + :'config' => :'LoyaltiesTiersGetResponseBodyConfig', :'expiration' => :'LoyaltyTierExpiration', :'object' => :'String' } @@ -115,37 +115,30 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'earning_rules', + :'rewards', + :'points', + :'id', + :'campaign_id', :'metadata', + :'created_at', :'updated_at', + :'config', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'LoyaltyTier' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesTiersGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesTiersGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'earning_rules') @@ -162,32 +155,22 @@ def initialize(attributes = {}) if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -196,8 +179,6 @@ def initialize(attributes = {}) if attributes.key?(:'config') self.config = attributes[:'config'] - else - self.config = nil end if attributes.key?(:'expiration') @@ -216,34 +197,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @config.nil? - invalid_properties.push('invalid value for "config", config cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -251,28 +204,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @points.nil? - return false if @id.nil? - return false if @campaign_id.nil? - return false if @created_at.nil? - return false if @config.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["loyalty_tier"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["loyalty_tier"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_config.rb b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_config.rb new file mode 100644 index 00000000..6d23b5e7 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_config.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines loyalty tier range in points. + class LoyaltiesTiersGetResponseBodyConfig + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'LoyaltiesTiersGetResponseBodyConfigPoints' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_config_points.rb b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_config_points.rb new file mode 100644 index 00000000..a760b244 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_config_points.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines range of loyalty tier in points. + class LoyaltiesTiersGetResponseBodyConfigPoints + # Bottom points threshold value. + attr_accessor :from + + # Top points threshold value. + attr_accessor :to + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'Integer', + :'to' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'from', + :'to' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from, to].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_points.rb b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_points.rb new file mode 100644 index 00000000..2a3b2938 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_tiers_get_response_body_points.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines range of loyalty tier in points. + class LoyaltiesTiersGetResponseBodyPoints + # Bottom points threshold value. + attr_accessor :from + + # Top points threshold value. + attr_accessor :to + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'Integer', + :'to' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'from', + :'to' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from, to].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_tiers_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_tiers_list_response_body.rb index e91d44cf..f55bdaeb 100644 --- a/lib/VoucherifySdk/models/loyalties_tiers_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_tiers_list_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/tiers`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/tiers`. class LoyaltiesTiersListResponseBody - # The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary. + # The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of loyalty tier objects. attr_accessor :data_ref - # This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers. + # This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer's tiers. attr_accessor :data # Total number of loyalty tier objects. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesTiersListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesTiersListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,22 +121,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -151,37 +128,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalties_tiers_rewards_list_response_body.rb b/lib/VoucherifySdk/models/loyalties_tiers_rewards_list_response_body.rb index 84076394..6efe63fe 100644 --- a/lib/VoucherifySdk/models/loyalties_tiers_rewards_list_response_body.rb +++ b/lib/VoucherifySdk/models/loyalties_tiers_rewards_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards`. + # Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards`. class LoyaltiesTiersRewardsListResponseBody - # The type of object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. + # The type of the object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of loyalty tier reward objects. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesTiersRewardsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesTiersRewardsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/loyalties_transfer_points.rb b/lib/VoucherifySdk/models/loyalties_transfer_points.rb index 61cecc1b..05a15776 100644 --- a/lib/VoucherifySdk/models/loyalties_transfer_points.rb +++ b/lib/VoucherifySdk/models/loyalties_transfer_points.rb @@ -24,7 +24,7 @@ class LoyaltiesTransferPoints # Reason for the transfer. attr_accessor :reason - # The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. + # The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. attr_accessor :source_id # Attribute mapping from ruby-style variable name to JSON key. @@ -55,34 +55,27 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'code', + :'points', + :'reason', + :'source_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltiesTransferPoints` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltiesTransferPoints`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'reason') @@ -91,8 +84,6 @@ def initialize(attributes = {}) if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end end @@ -101,18 +92,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @source_id.nil? - invalid_properties.push('invalid value for "source_id", source_id cannot be nil.') - end - invalid_properties end @@ -120,9 +99,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? - return false if @points.nil? - return false if @source_id.nil? true end diff --git a/lib/VoucherifySdk/models/loyalties_update_campaign_request_body.rb b/lib/VoucherifySdk/models/loyalties_update_campaign_request_body.rb new file mode 100644 index 00000000..7d99418b --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_update_campaign_request_body.rb @@ -0,0 +1,395 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request body schema for **PUT** `/loyalties/{campaignId}`. + class LoyaltiesUpdateCampaignRequestBody + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # The category assigned to the campaign. Either pass this parameter OR the `category_id`. + attr_accessor :category + + # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + attr_accessor :metadata + + # Determine which metadata should be removed from campaign. + attr_accessor :unset_metadata_fields + + # Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + attr_accessor :category_id + + # Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + attr_accessor :type + + attr_accessor :loyalty_tiers_expiration + + attr_accessor :options + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'description' => :'description', + :'category' => :'category', + :'metadata' => :'metadata', + :'unset_metadata_fields' => :'unset_metadata_fields', + :'category_id' => :'category_id', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'join_once' => :'join_once', + :'auto_join' => :'auto_join', + :'type' => :'type', + :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', + :'options' => :'options' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'description' => :'String', + :'category' => :'String', + :'metadata' => :'Object', + :'unset_metadata_fields' => :'Array', + :'category_id' => :'String', + :'activity_duration_after_publishing' => :'String', + :'join_once' => :'Boolean', + :'auto_join' => :'Boolean', + :'type' => :'String', + :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', + :'options' => :'LoyaltiesUpdateCampaignRequestBodyOptions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'start_date', + :'expiration_date', + :'description', + :'category', + :'metadata', + :'unset_metadata_fields', + :'category_id', + :'activity_duration_after_publishing', + :'join_once', + :'auto_join', + :'type', + :'options' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'unset_metadata_fields') + if (value = attributes[:'unset_metadata_fields']).is_a?(Array) + self.unset_metadata_fields = value + end + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'loyalty_tiers_expiration') + self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] + end + + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + description == o.description && + category == o.category && + metadata == o.metadata && + unset_metadata_fields == o.unset_metadata_fields && + category_id == o.category_id && + activity_duration_after_publishing == o.activity_duration_after_publishing && + join_once == o.join_once && + auto_join == o.auto_join && + type == o.type && + loyalty_tiers_expiration == o.loyalty_tiers_expiration && + options == o.options + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, description, category, metadata, unset_metadata_fields, category_id, activity_duration_after_publishing, join_once, auto_join, type, loyalty_tiers_expiration, options].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_update_campaign_request_body_options.rb b/lib/VoucherifySdk/models/loyalties_update_campaign_request_body_options.rb new file mode 100644 index 00000000..97edf181 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_update_campaign_request_body_options.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltiesUpdateCampaignRequestBodyOptions + # Determine if tiers should be recalculated or no. + attr_accessor :recalculate_tiers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'recalculate_tiers' => :'recalculate_tiers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'recalculate_tiers' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'recalculate_tiers' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'recalculate_tiers') + self.recalculate_tiers = attributes[:'recalculate_tiers'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + recalculate_tiers == o.recalculate_tiers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [recalculate_tiers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalties_update_campaign_response_body.rb b/lib/VoucherifySdk/models/loyalties_update_campaign_response_body.rb new file mode 100644 index 00000000..b7ce026d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalties_update_campaign_response_body.rb @@ -0,0 +1,554 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `/loyalties/{campaignId}`. + class LoyaltiesUpdateCampaignResponseBody + # Unique campaign ID, assigned by Voucherify. + attr_accessor :id + + # Campaign name. + attr_accessor :name + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # Type of campaign. + attr_accessor :campaign_type + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + attr_accessor :type + + attr_accessor :voucher + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + attr_accessor :use_voucher_metadata_schema + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # Total number of unique vouchers in campaign. + attr_accessor :vouchers_count + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + # A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + attr_accessor :metadata + + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique category name. + attr_accessor :category + + # Indicates the status of the campaign creation. + attr_accessor :creation_status + + # Indicates the status of the campaign's voucher generation. + attr_accessor :vouchers_generation_status + + # Indicates whether the resource can be deleted. + attr_accessor :protected + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # Contains details about the category. + attr_accessor :categories + + # The type of the object represented by JSON. This object stores information about the campaign. + attr_accessor :object + + attr_accessor :loyalty_tiers_expiration + + attr_accessor :validation_rules_assignments + + attr_accessor :access_settings_assignments + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'campaign_type' => :'campaign_type', + :'type' => :'type', + :'voucher' => :'voucher', + :'auto_join' => :'auto_join', + :'join_once' => :'join_once', + :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'vouchers_count' => :'vouchers_count', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'active' => :'active', + :'metadata' => :'metadata', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'category' => :'category', + :'creation_status' => :'creation_status', + :'vouchers_generation_status' => :'vouchers_generation_status', + :'protected' => :'protected', + :'category_id' => :'category_id', + :'categories' => :'categories', + :'object' => :'object', + :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'campaign_type' => :'String', + :'type' => :'String', + :'voucher' => :'LoyaltyCampaignVoucher', + :'auto_join' => :'Boolean', + :'join_once' => :'Boolean', + :'use_voucher_metadata_schema' => :'Boolean', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'activity_duration_after_publishing' => :'String', + :'vouchers_count' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'active' => :'Boolean', + :'metadata' => :'Object', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'category' => :'String', + :'creation_status' => :'String', + :'vouchers_generation_status' => :'String', + :'protected' => :'Boolean', + :'category_id' => :'String', + :'categories' => :'Array', + :'object' => :'String', + :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', + :'category_id', + :'categories', + :'object', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + else + self.campaign_type = 'LOYALTY_PROGRAM' + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'use_voucher_metadata_schema') + self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'vouchers_count') + self.vouchers_count = attributes[:'vouchers_count'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'creation_status') + self.creation_status = attributes[:'creation_status'] + end + + if attributes.key?(:'vouchers_generation_status') + self.vouchers_generation_status = attributes[:'vouchers_generation_status'] + end + + if attributes.key?(:'protected') + self.protected = attributes[:'protected'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + + if attributes.key?(:'loyalty_tiers_expiration') + self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) + return false unless campaign_type_validator.valid?(@campaign_type) + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless creation_status_validator.valid?(@creation_status) + vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + campaign_type == o.campaign_type && + type == o.type && + voucher == o.voucher && + auto_join == o.auto_join && + join_once == o.join_once && + use_voucher_metadata_schema == o.use_voucher_metadata_schema && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + activity_duration_after_publishing == o.activity_duration_after_publishing && + vouchers_count == o.vouchers_count && + start_date == o.start_date && + expiration_date == o.expiration_date && + active == o.active && + metadata == o.metadata && + created_at == o.created_at && + updated_at == o.updated_at && + category == o.category && + creation_status == o.creation_status && + vouchers_generation_status == o.vouchers_generation_status && + protected == o.protected && + category_id == o.category_id && + categories == o.categories && + object == o.object && + loyalty_tiers_expiration == o.loyalty_tiers_expiration && + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, loyalty_tiers_expiration, validation_rules_assignments, access_settings_assignments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_campaign.rb b/lib/VoucherifySdk/models/loyalty_campaign.rb new file mode 100644 index 00000000..8340ebc1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_campaign.rb @@ -0,0 +1,553 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class LoyaltyCampaign + # Unique campaign ID, assigned by Voucherify. + attr_accessor :id + + # Campaign name. + attr_accessor :name + + # An optional field to keep any extra textual information about the campaign such as a campaign description and details. + attr_accessor :description + + # Type of campaign. + attr_accessor :campaign_type + + # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + attr_accessor :type + + attr_accessor :voucher + + # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + attr_accessor :auto_join + + # If this value is set to `true`, customers will be able to join the campaign only once. + attr_accessor :join_once + + # Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + attr_accessor :use_voucher_metadata_schema + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + attr_accessor :activity_duration_after_publishing + + # Total number of unique vouchers in campaign. + attr_accessor :vouchers_count + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + # A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + attr_accessor :metadata + + # Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique category name. + attr_accessor :category + + # Indicates the status of the campaign creation. + attr_accessor :creation_status + + # Indicates the status of the campaign's voucher generation. + attr_accessor :vouchers_generation_status + + # Indicates whether the resource can be deleted. + attr_accessor :protected + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # Contains details about the category. + attr_accessor :categories + + # The type of the object represented by JSON. This object stores information about the campaign. + attr_accessor :object + + attr_accessor :loyalty_tiers_expiration + + attr_accessor :validation_rules_assignments + + attr_accessor :access_settings_assignments + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'campaign_type' => :'campaign_type', + :'type' => :'type', + :'voucher' => :'voucher', + :'auto_join' => :'auto_join', + :'join_once' => :'join_once', + :'use_voucher_metadata_schema' => :'use_voucher_metadata_schema', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'activity_duration_after_publishing' => :'activity_duration_after_publishing', + :'vouchers_count' => :'vouchers_count', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'active' => :'active', + :'metadata' => :'metadata', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'category' => :'category', + :'creation_status' => :'creation_status', + :'vouchers_generation_status' => :'vouchers_generation_status', + :'protected' => :'protected', + :'category_id' => :'category_id', + :'categories' => :'categories', + :'object' => :'object', + :'loyalty_tiers_expiration' => :'loyalty_tiers_expiration', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'access_settings_assignments' => :'access_settings_assignments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'campaign_type' => :'String', + :'type' => :'String', + :'voucher' => :'LoyaltyCampaignVoucher', + :'auto_join' => :'Boolean', + :'join_once' => :'Boolean', + :'use_voucher_metadata_schema' => :'Boolean', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'activity_duration_after_publishing' => :'String', + :'vouchers_count' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'active' => :'Boolean', + :'metadata' => :'Object', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'category' => :'String', + :'creation_status' => :'String', + :'vouchers_generation_status' => :'String', + :'protected' => :'Boolean', + :'category_id' => :'String', + :'categories' => :'Array', + :'object' => :'String', + :'loyalty_tiers_expiration' => :'LoyaltyTiersExpirationAll', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'access_settings_assignments' => :'AccessSettingsCampaignAssignmentsList' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'description', + :'campaign_type', + :'type', + :'auto_join', + :'join_once', + :'use_voucher_metadata_schema', + :'activity_duration_after_publishing', + :'vouchers_count', + :'start_date', + :'expiration_date', + :'active', + :'metadata', + :'created_at', + :'updated_at', + :'category', + :'creation_status', + :'vouchers_generation_status', + :'protected', + :'category_id', + :'categories', + :'object', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + else + self.campaign_type = 'LOYALTY_PROGRAM' + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'auto_join') + self.auto_join = attributes[:'auto_join'] + end + + if attributes.key?(:'join_once') + self.join_once = attributes[:'join_once'] + end + + if attributes.key?(:'use_voucher_metadata_schema') + self.use_voucher_metadata_schema = attributes[:'use_voucher_metadata_schema'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'activity_duration_after_publishing') + self.activity_duration_after_publishing = attributes[:'activity_duration_after_publishing'] + end + + if attributes.key?(:'vouchers_count') + self.vouchers_count = attributes[:'vouchers_count'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'creation_status') + self.creation_status = attributes[:'creation_status'] + end + + if attributes.key?(:'vouchers_generation_status') + self.vouchers_generation_status = attributes[:'vouchers_generation_status'] + end + + if attributes.key?(:'protected') + self.protected = attributes[:'protected'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + + if attributes.key?(:'loyalty_tiers_expiration') + self.loyalty_tiers_expiration = attributes[:'loyalty_tiers_expiration'] + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'access_settings_assignments') + self.access_settings_assignments = attributes[:'access_settings_assignments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + campaign_type_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM"]) + return false unless campaign_type_validator.valid?(@campaign_type) + type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) + return false unless type_validator.valid?(@type) + creation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless creation_status_validator.valid?(@creation_status) + vouchers_generation_status_validator = EnumAttributeValidator.new('String', ["DONE", "IN_PROGRESS", "FAILED", "DRAFT", "MODIFYING"]) + return false unless vouchers_generation_status_validator.valid?(@vouchers_generation_status) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + campaign_type == o.campaign_type && + type == o.type && + voucher == o.voucher && + auto_join == o.auto_join && + join_once == o.join_once && + use_voucher_metadata_schema == o.use_voucher_metadata_schema && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + activity_duration_after_publishing == o.activity_duration_after_publishing && + vouchers_count == o.vouchers_count && + start_date == o.start_date && + expiration_date == o.expiration_date && + active == o.active && + metadata == o.metadata && + created_at == o.created_at && + updated_at == o.updated_at && + category == o.category && + creation_status == o.creation_status && + vouchers_generation_status == o.vouchers_generation_status && + protected == o.protected && + category_id == o.category_id && + categories == o.categories && + object == o.object && + loyalty_tiers_expiration == o.loyalty_tiers_expiration && + validation_rules_assignments == o.validation_rules_assignments && + access_settings_assignments == o.access_settings_assignments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, campaign_type, type, voucher, auto_join, join_once, use_voucher_metadata_schema, validity_timeframe, validity_day_of_week, validity_hours, activity_duration_after_publishing, vouchers_count, start_date, expiration_date, active, metadata, created_at, updated_at, category, creation_status, vouchers_generation_status, protected, category_id, categories, object, loyalty_tiers_expiration, validation_rules_assignments, access_settings_assignments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_campaign_voucher.rb b/lib/VoucherifySdk/models/loyalty_campaign_voucher.rb new file mode 100644 index 00000000..03154566 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_campaign_voucher.rb @@ -0,0 +1,334 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Schema model for a campaign voucher. + class LoyaltyCampaignVoucher + # Type of voucher. + attr_accessor :type + + attr_accessor :loyalty_card + + attr_accessor :redemption + + attr_accessor :code_config + + # Always `false` for a loyalty card voucher + attr_accessor :is_referral_code + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'loyalty_card' => :'loyalty_card', + :'redemption' => :'redemption', + :'code_config' => :'code_config', + :'is_referral_code' => :'is_referral_code', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'loyalty_card' => :'CampaignLoyaltyCard', + :'redemption' => :'LoyaltyCampaignVoucherRedemption', + :'code_config' => :'CodeConfig', + :'is_referral_code' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'redemption', + :'is_referral_code', + :'start_date', + :'expiration_date', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'LOYALTY_CARD' + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'code_config') + self.code_config = attributes[:'code_config'] + else + self.code_config = nil + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @code_config.nil? + invalid_properties.push('invalid value for "code_config", code_config cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + return false if @code_config.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + loyalty_card == o.loyalty_card && + redemption == o.redemption && + code_config == o.code_config && + is_referral_code == o.is_referral_code && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, loyalty_card, redemption, code_config, is_referral_code, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_campaign_voucher_redemption.rb b/lib/VoucherifySdk/models/loyalty_campaign_voucher_redemption.rb new file mode 100644 index 00000000..7b31c5a2 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_campaign_voucher_redemption.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the redemption limits on vouchers. + class LoyaltyCampaignVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction.rb b/lib/VoucherifySdk/models/loyalty_card_transaction.rb index 01dc840a..e0cdfcd8 100644 --- a/lib/VoucherifySdk/models/loyalty_card_transaction.rb +++ b/lib/VoucherifySdk/models/loyalty_card_transaction.rb @@ -18,7 +18,7 @@ class LoyaltyCardTransaction # Unique transaction ID. attr_accessor :id - # The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. + # The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. attr_accessor :source_id # Unique voucher ID. @@ -40,7 +40,7 @@ class LoyaltyCardTransaction # The related transaction ID on the receiving card. attr_accessor :related_transaction_id - # Timestamp representing the date and time when the transaction was created in ISO 8601 format. + # Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. attr_accessor :created_at class EnumAttributeValidator @@ -96,7 +96,7 @@ def self.openapi_types :'source' => :'String', :'reason' => :'String', :'type' => :'LoyaltyCardTransactionsType', - :'details' => :'VoucherTransactionDetails', + :'details' => :'LoyaltyCardTransactionDetails', :'related_transaction_id' => :'String', :'created_at' => :'Time' } @@ -105,69 +105,48 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'voucher_id', + :'campaign_id', :'source', :'reason', + :'details', :'related_transaction_id', + :'created_at' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'VoucherTransaction' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyCardTransaction` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyCardTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'voucher_id') self.voucher_id = attributes[:'voucher_id'] - else - self.voucher_id = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end if attributes.key?(:'reason') self.reason = attributes[:'reason'] - else - self.reason = nil end if attributes.key?(:'type') @@ -178,20 +157,14 @@ def initialize(attributes = {}) if attributes.key?(:'details') self.details = attributes[:'details'] - else - self.details = nil end if attributes.key?(:'related_transaction_id') self.related_transaction_id = attributes[:'related_transaction_id'] - else - self.related_transaction_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end end @@ -200,30 +173,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @voucher_id.nil? - invalid_properties.push('invalid value for "voucher_id", voucher_id cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end - if @details.nil? - invalid_properties.push('invalid value for "details", details cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - invalid_properties end @@ -231,12 +184,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @voucher_id.nil? - return false if @campaign_id.nil? return false if @type.nil? - return false if @details.nil? - return false if @created_at.nil? true end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details.rb new file mode 100644 index 00000000..b0e5d9b2 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details.rb @@ -0,0 +1,327 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the detailed information about the transaction. + class LoyaltyCardTransactionDetails + attr_accessor :balance + + attr_accessor :order + + attr_accessor :event + + attr_accessor :earning_rule + + attr_accessor :segment + + attr_accessor :loyalty_tier + + attr_accessor :redemption + + attr_accessor :rollback + + attr_accessor :custom_event + + attr_accessor :event_schema + + attr_accessor :reward + + attr_accessor :source_voucher + + attr_accessor :destination_voucher + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'balance' => :'balance', + :'order' => :'order', + :'event' => :'event', + :'earning_rule' => :'earning_rule', + :'segment' => :'segment', + :'loyalty_tier' => :'loyalty_tier', + :'redemption' => :'redemption', + :'rollback' => :'rollback', + :'custom_event' => :'custom_event', + :'event_schema' => :'event_schema', + :'reward' => :'reward', + :'source_voucher' => :'source_voucher', + :'destination_voucher' => :'destination_voucher' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'balance' => :'LoyaltyCardTransactionDetailsBalance', + :'order' => :'LoyaltyCardTransactionDetailsOrder', + :'event' => :'LoyaltyCardTransactionDetailsEvent', + :'earning_rule' => :'LoyaltyCardTransactionDetailsEarningRule', + :'segment' => :'LoyaltyCardTransactionDetailsSegment', + :'loyalty_tier' => :'LoyaltyCardTransactionDetailsLoyaltyTier', + :'redemption' => :'LoyaltyCardTransactionDetailsRedemption', + :'rollback' => :'LoyaltyCardTransactionDetailsRollback', + :'custom_event' => :'LoyaltyCardTransactionDetailsCustomEvent', + :'event_schema' => :'LoyaltyCardTransactionDetailsEventSchema', + :'reward' => :'LoyaltyCardTransactionDetailsReward', + :'source_voucher' => :'SimpleVoucher', + :'destination_voucher' => :'SimpleVoucher' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'balance', + :'order', + :'event', + :'earning_rule', + :'segment', + :'loyalty_tier', + :'redemption', + :'rollback', + :'custom_event', + :'event_schema', + :'reward', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'event') + self.event = attributes[:'event'] + end + + if attributes.key?(:'earning_rule') + self.earning_rule = attributes[:'earning_rule'] + end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'loyalty_tier') + self.loyalty_tier = attributes[:'loyalty_tier'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'rollback') + self.rollback = attributes[:'rollback'] + end + + if attributes.key?(:'custom_event') + self.custom_event = attributes[:'custom_event'] + end + + if attributes.key?(:'event_schema') + self.event_schema = attributes[:'event_schema'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + + if attributes.key?(:'source_voucher') + self.source_voucher = attributes[:'source_voucher'] + end + + if attributes.key?(:'destination_voucher') + self.destination_voucher = attributes[:'destination_voucher'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + balance == o.balance && + order == o.order && + event == o.event && + earning_rule == o.earning_rule && + segment == o.segment && + loyalty_tier == o.loyalty_tier && + redemption == o.redemption && + rollback == o.rollback && + custom_event == o.custom_event && + event_schema == o.event_schema && + reward == o.reward && + source_voucher == o.source_voucher && + destination_voucher == o.destination_voucher + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [balance, order, event, earning_rule, segment, loyalty_tier, redemption, rollback, custom_event, event_schema, reward, source_voucher, destination_voucher].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance.rb new file mode 100644 index 00000000..41ca80ed --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance.rb @@ -0,0 +1,306 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information on how the balance was affected by the transaction. + class LoyaltyCardTransactionDetailsBalance + # The type of voucher whose balance is being adjusted due to the transaction. + attr_accessor :type + + # The number of all points accumulated on the card as affected by add or subtract operations. + attr_accessor :total + + # The type of the object represented by the JSON. + attr_accessor :object + + # Points added or subtracted in the transaction. + attr_accessor :points + + # The available points on the card after the transaction as affected by redemption or rollback. + attr_accessor :balance + + attr_accessor :related_object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'total' => :'total', + :'object' => :'object', + :'points' => :'points', + :'balance' => :'balance', + :'related_object' => :'related_object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'total' => :'Integer', + :'object' => :'String', + :'points' => :'Integer', + :'balance' => :'Integer', + :'related_object' => :'LoyaltyCardTransactionDetailsBalanceRelatedObject' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'total', + :'object', + :'points', + :'balance', + :'related_object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'loyalty_card' + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'balance' + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'related_object') + self.related_object = attributes[:'related_object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/loyalty_card/) + if !@type.nil? && @type !~ pattern + invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/balance/) + if !@object.nil? && @object !~ pattern + invalid_properties.push("invalid value for \"object\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["loyalty_card"]) + return false unless type_validator.valid?(@type) + return false if !@type.nil? && @type !~ Regexp.new(/loyalty_card/) + object_validator = EnumAttributeValidator.new('String', ["balance"]) + return false unless object_validator.valid?(@object) + return false if !@object.nil? && @object !~ Regexp.new(/balance/) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + total == o.total && + object == o.object && + points == o.points && + balance == o.balance && + related_object == o.related_object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, total, object, points, balance, related_object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance_related_object.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance_related_object.rb new file mode 100644 index 00000000..aa649044 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_balance_related_object.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the resource that is being modified with the values that are returned in the balance object. + class LoyaltyCardTransactionDetailsBalanceRelatedObject + # Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. + attr_accessor :id + + # The object being modified, i.e. voucher. + attr_accessor :type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'voucher' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/voucher/) + if !@type.nil? && @type !~ pattern + invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["voucher"]) + return false unless type_validator.valid?(@type) + return false if !@type.nil? && @type !~ Regexp.new(/voucher/) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_custom_event.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_custom_event.rb new file mode 100644 index 00000000..e6141384 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_custom_event.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the custom event that triggers the point accrual. + class LoyaltyCardTransactionDetailsCustomEvent + # Unique event ID. + attr_accessor :id + + # Type of custom event. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule.rb new file mode 100644 index 00000000..c6fb4dcf --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule.rb @@ -0,0 +1,220 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the earning rule. + class LoyaltyCardTransactionDetailsEarningRule + # Unique earning rule ID. + attr_accessor :id + + attr_accessor :source + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source' => :'source' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source' => :'LoyaltyCardTransactionDetailsEarningRuleSource' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source == o.source + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule_source.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule_source.rb new file mode 100644 index 00000000..b930b4fe --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule_source.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the custom earning rule name. + class LoyaltyCardTransactionDetailsEarningRuleSource + # Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + attr_accessor :banner + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'banner' => :'banner' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'banner' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'banner' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + banner == o.banner + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [banner].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_event.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_event.rb new file mode 100644 index 00000000..a3d7f6d1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_event.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the event that triggers the point accrual. + class LoyaltyCardTransactionDetailsEvent + # Unique event ID. + attr_accessor :id + + # Type of event. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_event_schema.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_event_schema.rb new file mode 100644 index 00000000..8d9f321d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_event_schema.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the custom event metadata schema. + class LoyaltyCardTransactionDetailsEventSchema + # Unique metadata schema ID. + attr_accessor :id + + # Type of custom event. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_loyalty_tier.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_loyalty_tier.rb new file mode 100644 index 00000000..dc2872cf --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_loyalty_tier.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the loyalty tier. + class LoyaltyCardTransactionDetailsLoyaltyTier + attr_accessor :id + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_order.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_order.rb new file mode 100644 index 00000000..37ede4f6 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_order.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the original order. + class LoyaltyCardTransactionDetailsOrder + # Unique order ID. + attr_accessor :id + + # The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. + attr_accessor :source_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_redemption.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_redemption.rb new file mode 100644 index 00000000..fbde8415 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_redemption.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the original redemption. + class LoyaltyCardTransactionDetailsRedemption + # Unique redemption ID. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_reward.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_reward.rb new file mode 100644 index 00000000..b537ec71 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_reward.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the pay with points reward. + class LoyaltyCardTransactionDetailsReward + # Unique reward ID. + attr_accessor :id + + # Reward name. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_rollback.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_rollback.rb new file mode 100644 index 00000000..6dae97c1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_rollback.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the redemption rollback. + class LoyaltyCardTransactionDetailsRollback + # Unique redemption rollback ID. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transaction_details_segment.rb b/lib/VoucherifySdk/models/loyalty_card_transaction_details_segment.rb new file mode 100644 index 00000000..d1af1f93 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_card_transaction_details_segment.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the segment. + class LoyaltyCardTransactionDetailsSegment + attr_accessor :id + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_card_transactions_type.rb b/lib/VoucherifySdk/models/loyalty_card_transactions_type.rb index 769a8f1a..80ce043e 100644 --- a/lib/VoucherifySdk/models/loyalty_card_transactions_type.rb +++ b/lib/VoucherifySdk/models/loyalty_card_transactions_type.rb @@ -16,7 +16,6 @@ module VoucherifySdk class LoyaltyCardTransactionsType ACCRUAL = "POINTS_ACCRUAL".freeze - CANCELLATION = "POINTS_CANCELLATION".freeze REDEMPTION = "POINTS_REDEMPTION".freeze REFUND = "POINTS_REFUND".freeze ADDITION = "POINTS_ADDITION".freeze @@ -26,7 +25,7 @@ class LoyaltyCardTransactionsType TRANSFER_OUT = "POINTS_TRANSFER_OUT".freeze def self.all_vars - @all_vars ||= [ACCRUAL, CANCELLATION, REDEMPTION, REFUND, ADDITION, REMOVAL, EXPIRATION, TRANSFER_IN, TRANSFER_OUT].freeze + @all_vars ||= [ACCRUAL, REDEMPTION, REFUND, ADDITION, REMOVAL, EXPIRATION, TRANSFER_IN, TRANSFER_OUT].freeze end # Builds the enum from string diff --git a/lib/VoucherifySdk/models/loyalty_member.rb b/lib/VoucherifySdk/models/loyalty_member.rb new file mode 100644 index 00000000..5aaabd8d --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_member.rb @@ -0,0 +1,503 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This is an object representing a loyalty member. + class LoyaltyMember + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # This is always false for loyalty members. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique identifier of the customer who owns the voucher. + attr_accessor :holder_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Object', + :'gift' => :'Object', + :'loyalty_card' => :'LoyaltyMemberLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'object' => :'String', + :'publish' => :'LoyaltyMemberPublish', + :'redemption' => :'LoyaltyMemberRedemption' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'discount', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'object', + :'publish', + :'redemption' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'LOYALTY_CARD' + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + object == o.object && + publish == o.publish && + redemption == o.redemption + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, object, publish, redemption].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_member_loyalty_card.rb b/lib/VoucherifySdk/models/loyalty_member_loyalty_card.rb new file mode 100644 index 00000000..16b0414c --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_member_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class LoyaltyMemberLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_member_publish.rb b/lib/VoucherifySdk/models/loyalty_member_publish.rb new file mode 100644 index 00000000..1f50fffa --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_member_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + class LoyaltyMemberPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication event counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_member_redemption.rb b/lib/VoucherifySdk/models/loyalty_member_redemption.rb new file mode 100644 index 00000000..8423ec0e --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_member_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class LoyaltyMemberRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_tier.rb b/lib/VoucherifySdk/models/loyalty_tier.rb index 087c6390..d3f63326 100644 --- a/lib/VoucherifySdk/models/loyalty_tier.rb +++ b/lib/VoucherifySdk/models/loyalty_tier.rb @@ -35,17 +35,17 @@ class LoyaltyTier # The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format. + # Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at attr_accessor :config attr_accessor :expiration - # The type of object represented by JSON. This object stores information about the loyalty. + # The type of the object represented by JSON. This object stores information about the loyalty. attr_accessor :object class EnumAttributeValidator @@ -99,13 +99,13 @@ def self.openapi_types :'name' => :'String', :'earning_rules' => :'Hash', :'rewards' => :'Hash', - :'points' => :'LoyaltyTierBasePoints', + :'points' => :'LoyaltyTierPoints', :'id' => :'String', :'campaign_id' => :'String', :'metadata' => :'Object', :'created_at' => :'Time', :'updated_at' => :'Time', - :'config' => :'LoyaltyTierAllOfConfig', + :'config' => :'LoyaltyTierConfig', :'expiration' => :'LoyaltyTierExpiration', :'object' => :'String' } @@ -114,37 +114,30 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'earning_rules', + :'rewards', + :'points', + :'id', + :'campaign_id', :'metadata', + :'created_at', :'updated_at', + :'config', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'LoyaltyTierBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTier` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'earning_rules') @@ -161,32 +154,22 @@ def initialize(attributes = {}) if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -195,8 +178,6 @@ def initialize(attributes = {}) if attributes.key?(:'config') self.config = attributes[:'config'] - else - self.config = nil end if attributes.key?(:'expiration') @@ -215,34 +196,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @config.nil? - invalid_properties.push('invalid value for "config", config cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -250,28 +203,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @points.nil? - return false if @id.nil? - return false if @campaign_id.nil? - return false if @created_at.nil? - return false if @config.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["loyalty_tier"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["loyalty_tier"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalty_tier_all_of_config.rb b/lib/VoucherifySdk/models/loyalty_tier_all_of_config.rb deleted file mode 100644 index 41cbbb60..00000000 --- a/lib/VoucherifySdk/models/loyalty_tier_all_of_config.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines loyalty tier range in points. - class LoyaltyTierAllOfConfig - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'points' => :'LoyaltyTierAllOfConfigPoints' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTierAllOfConfig` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTierAllOfConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'points') - self.points = attributes[:'points'] - else - self.points = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @points.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/loyalty_tier_all_of_config_points.rb b/lib/VoucherifySdk/models/loyalty_tier_all_of_config_points.rb deleted file mode 100644 index f8865ed7..00000000 --- a/lib/VoucherifySdk/models/loyalty_tier_all_of_config_points.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines range of loyalty tier in points. - class LoyaltyTierAllOfConfigPoints - # Bottom points threshold value. - attr_accessor :from - - # Top points threshold value. - attr_accessor :to - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'from' => :'from', - :'to' => :'to' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'from' => :'Integer', - :'to' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTierAllOfConfigPoints` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTierAllOfConfigPoints`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'from') - self.from = attributes[:'from'] - end - - if attributes.key?(:'to') - self.to = attributes[:'to'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - from == o.from && - to == o.to - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [from, to].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/loyalty_tier_base.rb b/lib/VoucherifySdk/models/loyalty_tier_base.rb index 74bcce4e..f1e1ccc2 100644 --- a/lib/VoucherifySdk/models/loyalty_tier_base.rb +++ b/lib/VoucherifySdk/models/loyalty_tier_base.rb @@ -54,28 +54,23 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'earning_rules', + :'rewards', + :'points' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTierBase` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTierBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'earning_rules') @@ -92,8 +87,6 @@ def initialize(attributes = {}) if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end end @@ -102,14 +95,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - invalid_properties end @@ -117,8 +102,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @points.nil? true end diff --git a/lib/VoucherifySdk/models/loyalty_tier_base_points.rb b/lib/VoucherifySdk/models/loyalty_tier_base_points.rb index 7c6869c6..2a0cdddc 100644 --- a/lib/VoucherifySdk/models/loyalty_tier_base_points.rb +++ b/lib/VoucherifySdk/models/loyalty_tier_base_points.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'from', + :'to' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTierBasePoints` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTierBasePoints`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/loyalty_tier_config.rb b/lib/VoucherifySdk/models/loyalty_tier_config.rb new file mode 100644 index 00000000..1874e795 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_tier_config.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines loyalty tier range in points. + class LoyaltyTierConfig + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'LoyaltyTierConfigPoints' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_tier_config_points.rb b/lib/VoucherifySdk/models/loyalty_tier_config_points.rb new file mode 100644 index 00000000..d66d60d1 --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_tier_config_points.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines range of loyalty tier in points. + class LoyaltyTierConfigPoints + # Bottom points threshold value. + attr_accessor :from + + # Top points threshold value. + attr_accessor :to + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'Integer', + :'to' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'from', + :'to' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from, to].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_tier_expiration.rb b/lib/VoucherifySdk/models/loyalty_tier_expiration.rb index 68a798dd..8441af32 100644 --- a/lib/VoucherifySdk/models/loyalty_tier_expiration.rb +++ b/lib/VoucherifySdk/models/loyalty_tier_expiration.rb @@ -31,10 +31,10 @@ class LoyaltyTierExpiration # Expiration timestamp defines when the loyalty tier expires in ISO 8601 format. Loyalty tier is inactive after this date. attr_accessor :expiration_date - # Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format. + # Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. @@ -71,40 +71,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'customer_id', + :'campaign_id', + :'tier_id', + :'start_date', + :'expiration_date', + :'created_at', + :'updated_at' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTierExpiration` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTierExpiration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'tier_id') self.tier_id = attributes[:'tier_id'] - else - self.tier_id = nil end if attributes.key?(:'start_date') @@ -117,8 +111,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -131,22 +123,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @tier_id.nil? - invalid_properties.push('invalid value for "tier_id", tier_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - invalid_properties end @@ -154,10 +130,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @customer_id.nil? - return false if @campaign_id.nil? - return false if @tier_id.nil? - return false if @created_at.nil? true end diff --git a/lib/VoucherifySdk/models/loyalty_tier_points.rb b/lib/VoucherifySdk/models/loyalty_tier_points.rb new file mode 100644 index 00000000..b24651fb --- /dev/null +++ b/lib/VoucherifySdk/models/loyalty_tier_points.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines range of loyalty tier in points. + class LoyaltyTierPoints + # Bottom points threshold value. + attr_accessor :from + + # Top points threshold value. + attr_accessor :to + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'Integer', + :'to' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'from', + :'to' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from, to].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all.rb b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all.rb index cf5b9a2d..0810ba6f 100644 --- a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all.rb +++ b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all.rb @@ -76,28 +76,23 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'qualification_type', + :'qualification_period', + :'start_date', + :'expiration_date' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTiersExpirationAll` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTiersExpirationAll`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'qualification_type') self.qualification_type = attributes[:'qualification_type'] - else - self.qualification_type = nil end if attributes.key?(:'qualification_period') @@ -106,14 +101,10 @@ def initialize(attributes = {}) if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] - else - self.start_date = nil end if attributes.key?(:'expiration_date') self.expiration_date = attributes[:'expiration_date'] - else - self.expiration_date = nil end end @@ -122,18 +113,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @qualification_type.nil? - invalid_properties.push('invalid value for "qualification_type", qualification_type cannot be nil.') - end - - if @start_date.nil? - invalid_properties.push('invalid value for "start_date", start_date cannot be nil.') - end - - if @expiration_date.nil? - invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.') - end - invalid_properties end @@ -141,36 +120,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @qualification_type.nil? qualification_type_validator = EnumAttributeValidator.new('String', ["BALANCE", "POINTS_IN_PERIOD"]) return false unless qualification_type_validator.valid?(@qualification_type) qualification_period_validator = EnumAttributeValidator.new('String', ["MONTH", "QUARTER", "HALF_YEAR", "YEAR"]) return false unless qualification_period_validator.valid?(@qualification_period) - return false if @start_date.nil? - return false if @expiration_date.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] qualification_type Object to be assigned - def qualification_type=(qualification_type) - validator = EnumAttributeValidator.new('String', ["BALANCE", "POINTS_IN_PERIOD"]) - unless validator.valid?(qualification_type) - fail ArgumentError, "invalid value for \"qualification_type\", must be one of #{validator.allowable_values}." - end - @qualification_type = qualification_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] qualification_period Object to be assigned - def qualification_period=(qualification_period) - validator = EnumAttributeValidator.new('String', ["MONTH", "QUARTER", "HALF_YEAR", "YEAR"]) - unless validator.valid?(qualification_period) - fail ArgumentError, "invalid value for \"qualification_period\", must be one of #{validator.allowable_values}." - end - @qualification_period = qualification_period - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date.rb b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date.rb index d6876082..b3b780a8 100644 --- a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date.rb +++ b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date.rb @@ -72,34 +72,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'extend', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTiersExpirationAllExpirationDate` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTiersExpirationAllExpirationDate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'extend') self.extend = attributes[:'extend'] - else - self.extend = nil end if attributes.key?(:'rounding') @@ -112,14 +103,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @extend.nil? - invalid_properties.push('invalid value for "extend", extend cannot be nil.') - end - invalid_properties end @@ -127,23 +110,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["END_OF_PERIOD", "END_OF_NEXT_PERIOD", "BALANCE_DROP", "CUSTOM"]) return false unless type_validator.valid?(@type) - return false if @extend.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["END_OF_PERIOD", "END_OF_NEXT_PERIOD", "BALANCE_DROP", "CUSTOM"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date_rounding.rb b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date_rounding.rb index 64d79e38..b1519285 100644 --- a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date_rounding.rb +++ b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_expiration_date_rounding.rb @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'strategy', + :'unit', + :'value' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTiersExpirationAllExpirationDateRounding` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTiersExpirationAllExpirationDateRounding`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -136,36 +133,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["MONTH", "QUARTER", "HALF_YEAR", "YEAR", "CUSTOM"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] strategy Object to be assigned - def strategy=(strategy) - validator = EnumAttributeValidator.new('String', ["START", "END"]) - unless validator.valid?(strategy) - fail ArgumentError, "invalid value for \"strategy\", must be one of #{validator.allowable_values}." - end - @strategy = strategy - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] unit Object to be assigned - def unit=(unit) - validator = EnumAttributeValidator.new('String', ["MONTH"]) - unless validator.valid?(unit) - fail ArgumentError, "invalid value for \"unit\", must be one of #{validator.allowable_values}." - end - @unit = unit - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_start_date.rb b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_start_date.rb index 78d5dc43..63b6fbd8 100644 --- a/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_start_date.rb +++ b/lib/VoucherifySdk/models/loyalty_tiers_expiration_all_start_date.rb @@ -63,28 +63,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LoyaltyTiersExpirationAllStartDate` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LoyaltyTiersExpirationAllStartDate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end end @@ -93,10 +85,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - invalid_properties end @@ -104,22 +92,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["IMMEDIATE", "NEXT_PERIOD"]) return false unless type_validator.valid?(@type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["IMMEDIATE", "NEXT_PERIOD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/lucky_draw.rb b/lib/VoucherifySdk/models/lucky_draw.rb index 7803b318..3ebf14dc 100644 --- a/lib/VoucherifySdk/models/lucky_draw.rb +++ b/lib/VoucherifySdk/models/lucky_draw.rb @@ -51,21 +51,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'winners_count', + :'unique_winners_per_draw', + :'unique_winners' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::LuckyDraw` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::LuckyDraw`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -97,16 +93,6 @@ def valid? true end - # Custom attribute writer method with validation - # @param [Object] winners_count Value to be assigned - def winners_count=(winners_count) - if winners_count.nil? - fail ArgumentError, 'winners_count cannot be nil' - end - - @winners_count = winners_count - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/mapping_fixed.rb b/lib/VoucherifySdk/models/mapping_fixed.rb deleted file mode 100644 index 3b082f9d..00000000 --- a/lib/VoucherifySdk/models/mapping_fixed.rb +++ /dev/null @@ -1,261 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class MappingFixed - # Type of calculation. - attr_accessor :type - - # Fixed number of points to be applied. - attr_accessor :points - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::MappingFixed` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::MappingFixed`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'CUSTOM' - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["CUSTOM"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["CUSTOM"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/mapping_multiply.rb b/lib/VoucherifySdk/models/mapping_multiply.rb deleted file mode 100644 index da5e2175..00000000 --- a/lib/VoucherifySdk/models/mapping_multiply.rb +++ /dev/null @@ -1,261 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class MappingMultiply - # Type of calculation. - attr_accessor :type - - # Multiplication factor used to multiply the points to obtain the mapped points. - attr_accessor :multiplier - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'multiplier' => :'multiplier' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'multiplier' => :'Float' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::MappingMultiply` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::MappingMultiply`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'MULTIPLY' - end - - if attributes.key?(:'multiplier') - self.multiplier = attributes[:'multiplier'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["MULTIPLY", "CUSTOM"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["MULTIPLY", "CUSTOM"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - multiplier == o.multiplier - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, multiplier].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/mapping_points.rb b/lib/VoucherifySdk/models/mapping_points.rb index 7280c482..39ace311 100644 --- a/lib/VoucherifySdk/models/mapping_points.rb +++ b/lib/VoucherifySdk/models/mapping_points.rb @@ -14,92 +14,241 @@ require 'time' module VoucherifySdk - module MappingPoints - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'MappingFixed', - :'MappingMultiply' - ] - end + class MappingPoints + attr_accessor :type + + # Multiplication factor used to multiply the points to obtain the mapped points. + attr_accessor :multiplier + + # Fixed number of points to be applied. + attr_accessor :points + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil + def valid?(value) + !value || allowable_values.include?(value) end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'multiplier' => :'multiplier', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'multiplier' => :'Float', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'type', + :'multiplier', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'multiplier') + self.multiplier = attributes[:'multiplier'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["MULTIPLY", "CUSTOM"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + multiplier == o.multiplier && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, multiplier, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/member_activity.rb b/lib/VoucherifySdk/models/member_activity.rb new file mode 100644 index 00000000..7a36e529 --- /dev/null +++ b/lib/VoucherifySdk/models/member_activity.rb @@ -0,0 +1,254 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This is an object representing member activity. This is a general object which presents moments from members' activity. There are all types of different events that members perform during their journey once they participate in a loyalty program. Events describe moments when the members redeem loyalty cards and earn points or rewards. The list of all types of activities is listed below. The details describing the activity are collected in an array property named `data`. In this object, software integrators can find all further information explaining the event context. + class MemberActivity + # Unique event ID, assigned by Voucherify. + attr_accessor :id + + # Event type. + attr_accessor :type + + # Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. + attr_accessor :data + + # Timestamp representing the date and time when the member activity occurred in ISO 8601 format. + attr_accessor :created_at + + # Unique identifier of the request that caused the event. + attr_accessor :group_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type', + :'data' => :'data', + :'created_at' => :'created_at', + :'group_id' => :'group_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String', + :'data' => :'Object', + :'created_at' => :'Time', + :'group_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type', + :'data', + :'created_at', + :'group_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'group_id') + self.group_id = attributes[:'group_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + data == o.data && + created_at == o.created_at && + group_id == o.group_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type, data, created_at, group_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/order.rb b/lib/VoucherifySdk/models/order.rb index 4860a46a..0db1b788 100644 --- a/lib/VoucherifySdk/models/order.rb +++ b/lib/VoucherifySdk/models/order.rb @@ -14,41 +14,32 @@ require 'time' module VoucherifySdk + # Order information. class Order + # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + attr_accessor :id + + # Unique source ID of an existing order that will be linked to the redemption of this request. + attr_accessor :source_id + # The order status. attr_accessor :status - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :amount - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :initial_amount + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + # Array of items applied to the order. attr_accessor :items - attr_accessor :customer - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - attr_accessor :referrer - - # Unique referrer ID. - attr_accessor :referrer_id - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. attr_accessor :metadata - # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. - attr_accessor :id - - # Unique source ID of an existing order that will be linked to the redemption of this request. - attr_accessor :source_id - class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -74,18 +65,14 @@ def valid?(value) # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'id' => :'id', + :'source_id' => :'source_id', :'status' => :'status', :'amount' => :'amount', - :'discount_amount' => :'discount_amount', :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', :'items' => :'items', - :'customer' => :'customer', - :'customer_id' => :'customer_id', - :'referrer' => :'referrer', - :'referrer_id' => :'referrer_id', - :'metadata' => :'metadata', - :'id' => :'id', - :'source_id' => :'source_id' + :'metadata' => :'metadata' } end @@ -97,49 +84,47 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'id' => :'String', + :'source_id' => :'String', :'status' => :'String', :'amount' => :'Integer', - :'discount_amount' => :'Integer', :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', :'items' => :'Array', - :'customer' => :'Customer', - :'customer_id' => :'String', - :'referrer' => :'Referrer', - :'referrer_id' => :'String', - :'metadata' => :'Object', - :'id' => :'String', - :'source_id' => :'String' + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Order` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] end @@ -148,47 +133,23 @@ def initialize(attributes = {}) self.amount = attributes[:'amount'] end - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - if attributes.key?(:'initial_amount') self.initial_amount = attributes[:'initial_amount'] end + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - end - if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -208,33 +169,19 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + id == o.id && + source_id == o.source_id && status == o.status && amount == o.amount && - discount_amount == o.discount_amount && initial_amount == o.initial_amount && + discount_amount == o.discount_amount && items == o.items && - customer == o.customer && - customer_id == o.customer_id && - referrer == o.referrer && - referrer_id == o.referrer_id && - metadata == o.metadata && - id == o.id && - source_id == o.source_id + metadata == o.metadata end # @see the `==` method @@ -246,7 +193,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [status, amount, discount_amount, initial_amount, items, customer, customer_id, referrer, referrer_id, metadata, id, source_id].hash + [id, source_id, status, amount, initial_amount, discount_amount, items, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/order_base.rb b/lib/VoucherifySdk/models/order_base.rb deleted file mode 100644 index 08b4ade5..00000000 --- a/lib/VoucherifySdk/models/order_base.rb +++ /dev/null @@ -1,339 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class OrderBase - # The order status. - attr_accessor :status - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :amount - - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :initial_amount - - # Array of items applied to the order. - attr_accessor :items - - attr_accessor :customer - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - attr_accessor :referrer - - # Unique referrer ID. - attr_accessor :referrer_id - - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'status' => :'status', - :'amount' => :'amount', - :'discount_amount' => :'discount_amount', - :'initial_amount' => :'initial_amount', - :'items' => :'items', - :'customer' => :'customer', - :'customer_id' => :'customer_id', - :'referrer' => :'referrer', - :'referrer_id' => :'referrer_id', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'status' => :'String', - :'amount' => :'Integer', - :'discount_amount' => :'Integer', - :'initial_amount' => :'Integer', - :'items' => :'Array', - :'customer' => :'Customer', - :'customer_id' => :'String', - :'referrer' => :'Referrer', - :'referrer_id' => :'String', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - - if attributes.key?(:'initial_amount') - self.initial_amount = attributes[:'initial_amount'] - end - - if attributes.key?(:'items') - if (value = attributes[:'items']).is_a?(Array) - self.items = value - end - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - status == o.status && - amount == o.amount && - discount_amount == o.discount_amount && - initial_amount == o.initial_amount && - items == o.items && - customer == o.customer && - customer_id == o.customer_id && - referrer == o.referrer && - referrer_id == o.referrer_id && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [status, amount, discount_amount, initial_amount, items, customer, customer_id, referrer, referrer_id, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/order_calculated.rb b/lib/VoucherifySdk/models/order_calculated.rb index 2c3c7b62..5fe210ae 100644 --- a/lib/VoucherifySdk/models/order_calculated.rb +++ b/lib/VoucherifySdk/models/order_calculated.rb @@ -14,6 +14,7 @@ require 'time' module VoucherifySdk + # Order information. class OrderCalculated # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. attr_accessor :id @@ -21,12 +22,6 @@ class OrderCalculated # Unique source ID of an existing order that will be linked to the redemption of this request. attr_accessor :source_id - # Timestamp representing the date and time when the order was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the order was last updated in ISO 8601 format. - attr_accessor :updated_at - # The order status. attr_accessor :status @@ -63,21 +58,27 @@ class OrderCalculated # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. attr_accessor :metadata + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + # Unique customer ID of the customer making the purchase. attr_accessor :customer_id # Unique referrer ID. attr_accessor :referrer_id - # The type of object represented by JSON. - attr_accessor :object - - attr_accessor :redemptions - attr_accessor :customer attr_accessor :referrer + attr_accessor :redemptions + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -105,8 +106,6 @@ def self.attribute_map { :'id' => :'id', :'source_id' => :'source_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', :'status' => :'status', :'amount' => :'amount', :'initial_amount' => :'initial_amount', @@ -119,12 +118,14 @@ def self.attribute_map :'total_applied_discount_amount' => :'total_applied_discount_amount', :'items' => :'items', :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', :'customer_id' => :'customer_id', :'referrer_id' => :'referrer_id', - :'object' => :'object', - :'redemptions' => :'redemptions', :'customer' => :'customer', - :'referrer' => :'referrer' + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' } end @@ -138,8 +139,6 @@ def self.openapi_types { :'id' => :'String', :'source_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', :'status' => :'String', :'amount' => :'Integer', :'initial_amount' => :'Integer', @@ -150,46 +149,50 @@ def self.openapi_types :'applied_discount_amount' => :'Integer', :'items_applied_discount_amount' => :'Integer', :'total_applied_discount_amount' => :'Integer', - :'items' => :'Array', + :'items' => :'Array', :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', :'customer_id' => :'String', :'referrer_id' => :'String', - :'object' => :'String', - :'redemptions' => :'Hash', - :'customer' => :'OrderCalculatedCustomer', - :'referrer' => :'OrderCalculatedReferrer' + :'customer' => :'CustomerId', + :'referrer' => :'ReferrerId', + :'redemptions' => :'Hash' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'metadata', + :'object', + :'created_at', :'updated_at', :'customer_id', :'referrer_id', + :'redemptions' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderCalculatedBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderCalculated` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderCalculated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -199,16 +202,6 @@ def initialize(attributes = {}) if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] end if attributes.key?(:'status') @@ -261,28 +254,26 @@ def initialize(attributes = {}) self.metadata = attributes[:'metadata'] end - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'object') + self.object = attributes[:'object'] else - self.customer_id = nil + self.object = 'order' end - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - else - self.referrer_id = nil + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] end - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Hash) - self.redemptions = value - end + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'customer') @@ -292,6 +283,12 @@ def initialize(attributes = {}) if attributes.key?(:'referrer') self.referrer = attributes[:'referrer'] end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Hash) + self.redemptions = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -299,10 +296,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -312,32 +305,11 @@ def valid? warn '[DEPRECATED] the `valid?` method is obsolete' status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) return false unless status_validator.valid?(@status) - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["order"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -345,8 +317,6 @@ def ==(o) self.class == o.class && id == o.id && source_id == o.source_id && - created_at == o.created_at && - updated_at == o.updated_at && status == o.status && amount == o.amount && initial_amount == o.initial_amount && @@ -359,12 +329,14 @@ def ==(o) total_applied_discount_amount == o.total_applied_discount_amount && items == o.items && metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && customer_id == o.customer_id && referrer_id == o.referrer_id && - object == o.object && - redemptions == o.redemptions && customer == o.customer && - referrer == o.referrer + referrer == o.referrer && + redemptions == o.redemptions end # @see the `==` method @@ -376,7 +348,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, source_id, created_at, updated_at, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, customer_id, referrer_id, object, redemptions, customer, referrer].hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/order_calculated_base.rb b/lib/VoucherifySdk/models/order_calculated_base.rb deleted file mode 100644 index e7e48772..00000000 --- a/lib/VoucherifySdk/models/order_calculated_base.rb +++ /dev/null @@ -1,472 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Order information. - class OrderCalculatedBase - # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. - attr_accessor :id - - # Unique source ID of an existing order that will be linked to the redemption of this request. - attr_accessor :source_id - - # Timestamp representing the date and time when the order was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the order was last updated in ISO 8601 format. - attr_accessor :updated_at - - # The order status. - attr_accessor :status - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :amount - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :initial_amount - - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - - # Sum of all product-specific discounts applied to the order. - attr_accessor :items_discount_amount - - # Sum of all order-level AND all product-specific discounts applied to the order. - attr_accessor :total_discount_amount - - # Order amount after undoing all the discounts through the rollback redemption. - attr_accessor :total_amount - - # This field shows the order-level discount applied. - attr_accessor :applied_discount_amount - - # Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` - attr_accessor :items_applied_discount_amount - - # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` - attr_accessor :total_applied_discount_amount - - # Array of items applied to the order. - attr_accessor :items - - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - # Unique referrer ID. - attr_accessor :referrer_id - - # The type of object represented by JSON. - attr_accessor :object - - attr_accessor :redemptions - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'status' => :'status', - :'amount' => :'amount', - :'initial_amount' => :'initial_amount', - :'discount_amount' => :'discount_amount', - :'items_discount_amount' => :'items_discount_amount', - :'total_discount_amount' => :'total_discount_amount', - :'total_amount' => :'total_amount', - :'applied_discount_amount' => :'applied_discount_amount', - :'items_applied_discount_amount' => :'items_applied_discount_amount', - :'total_applied_discount_amount' => :'total_applied_discount_amount', - :'items' => :'items', - :'metadata' => :'metadata', - :'customer_id' => :'customer_id', - :'referrer_id' => :'referrer_id', - :'object' => :'object', - :'redemptions' => :'redemptions' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'status' => :'String', - :'amount' => :'Integer', - :'initial_amount' => :'Integer', - :'discount_amount' => :'Integer', - :'items_discount_amount' => :'Integer', - :'total_discount_amount' => :'Integer', - :'total_amount' => :'Integer', - :'applied_discount_amount' => :'Integer', - :'items_applied_discount_amount' => :'Integer', - :'total_applied_discount_amount' => :'Integer', - :'items' => :'Array', - :'metadata' => :'Object', - :'customer_id' => :'String', - :'referrer_id' => :'String', - :'object' => :'String', - :'redemptions' => :'Hash' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - :'updated_at', - :'customer_id', - :'referrer_id', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderCalculatedBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderCalculatedBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'initial_amount') - self.initial_amount = attributes[:'initial_amount'] - end - - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - - if attributes.key?(:'items_discount_amount') - self.items_discount_amount = attributes[:'items_discount_amount'] - end - - if attributes.key?(:'total_discount_amount') - self.total_discount_amount = attributes[:'total_discount_amount'] - end - - if attributes.key?(:'total_amount') - self.total_amount = attributes[:'total_amount'] - end - - if attributes.key?(:'applied_discount_amount') - self.applied_discount_amount = attributes[:'applied_discount_amount'] - end - - if attributes.key?(:'items_applied_discount_amount') - self.items_applied_discount_amount = attributes[:'items_applied_discount_amount'] - end - - if attributes.key?(:'total_applied_discount_amount') - self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] - end - - if attributes.key?(:'items') - if (value = attributes[:'items']).is_a?(Array) - self.items = value - end - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - else - self.referrer_id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' - end - - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Hash) - self.redemptions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - return false unless status_validator.valid?(@status) - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["order"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - created_at == o.created_at && - updated_at == o.updated_at && - status == o.status && - amount == o.amount && - initial_amount == o.initial_amount && - discount_amount == o.discount_amount && - items_discount_amount == o.items_discount_amount && - total_discount_amount == o.total_discount_amount && - total_amount == o.total_amount && - applied_discount_amount == o.applied_discount_amount && - items_applied_discount_amount == o.items_applied_discount_amount && - total_applied_discount_amount == o.total_applied_discount_amount && - items == o.items && - metadata == o.metadata && - customer_id == o.customer_id && - referrer_id == o.referrer_id && - object == o.object && - redemptions == o.redemptions - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, created_at, updated_at, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, customer_id, referrer_id, object, redemptions].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/order_calculated_customer.rb b/lib/VoucherifySdk/models/order_calculated_customer.rb deleted file mode 100644 index fa1b4f9f..00000000 --- a/lib/VoucherifySdk/models/order_calculated_customer.rb +++ /dev/null @@ -1,105 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module OrderCalculatedCustomer - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'CustomerId', - :'CustomerWithSummaryLoyaltyReferrals' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/order_calculated_item.rb b/lib/VoucherifySdk/models/order_calculated_item.rb new file mode 100644 index 00000000..ce07dd07 --- /dev/null +++ b/lib/VoucherifySdk/models/order_calculated_item.rb @@ -0,0 +1,455 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class OrderCalculatedItem + # Unique identifier of the order line item. + attr_accessor :id + + # Unique identifier of the SKU. It is assigned by Voucherify. + attr_accessor :sku_id + + # Unique identifier of the product. It is assigned by Voucherify. + attr_accessor :product_id + + # Used along with the source_id property, can be set to either sku or product. + attr_accessor :related_object + + # The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. + attr_accessor :source_id + + # The quantity of the particular item in the cart. + attr_accessor :quantity + + # Number of dicounted items. + attr_accessor :discount_quantity + + # A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. + attr_accessor :initial_quantity + + # The total amount of the order item (price * quantity). + attr_accessor :amount + + # Sum of all order-item-level discounts applied to the order. + attr_accessor :discount_amount + + # This field shows the order-level discount applied. + attr_accessor :applied_discount_amount + + # Number of the discounted items applied in the transaction. + attr_accessor :applied_discount_quantity + + # Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. + attr_accessor :applied_quantity + + # Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. + attr_accessor :applied_quantity_amount + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :initial_amount + + # Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + attr_accessor :price + + # Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` + attr_accessor :subtotal_amount + + attr_accessor :product + + attr_accessor :sku + + # The type of the object represented by JSON. + attr_accessor :object + + # A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. + attr_accessor :metadata + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'sku_id' => :'sku_id', + :'product_id' => :'product_id', + :'related_object' => :'related_object', + :'source_id' => :'source_id', + :'quantity' => :'quantity', + :'discount_quantity' => :'discount_quantity', + :'initial_quantity' => :'initial_quantity', + :'amount' => :'amount', + :'discount_amount' => :'discount_amount', + :'applied_discount_amount' => :'applied_discount_amount', + :'applied_discount_quantity' => :'applied_discount_quantity', + :'applied_quantity' => :'applied_quantity', + :'applied_quantity_amount' => :'applied_quantity_amount', + :'initial_amount' => :'initial_amount', + :'price' => :'price', + :'subtotal_amount' => :'subtotal_amount', + :'product' => :'product', + :'sku' => :'sku', + :'object' => :'object', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'sku_id' => :'String', + :'product_id' => :'String', + :'related_object' => :'String', + :'source_id' => :'String', + :'quantity' => :'Integer', + :'discount_quantity' => :'Integer', + :'initial_quantity' => :'Integer', + :'amount' => :'Integer', + :'discount_amount' => :'Integer', + :'applied_discount_amount' => :'Integer', + :'applied_discount_quantity' => :'Integer', + :'applied_quantity' => :'Integer', + :'applied_quantity_amount' => :'Integer', + :'initial_amount' => :'Integer', + :'price' => :'Integer', + :'subtotal_amount' => :'Integer', + :'product' => :'OrderCalculatedItemProduct', + :'sku' => :'OrderCalculatedItemSku', + :'object' => :'String', + :'metadata' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'sku_id', + :'product_id', + :'related_object', + :'source_id', + :'quantity', + :'discount_quantity', + :'initial_quantity', + :'amount', + :'discount_amount', + :'applied_discount_amount', + :'applied_discount_quantity', + :'applied_quantity', + :'applied_quantity_amount', + :'initial_amount', + :'price', + :'subtotal_amount', + :'product', + :'sku', + :'object', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'sku_id') + self.sku_id = attributes[:'sku_id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'related_object') + self.related_object = attributes[:'related_object'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'discount_quantity') + self.discount_quantity = attributes[:'discount_quantity'] + end + + if attributes.key?(:'initial_quantity') + self.initial_quantity = attributes[:'initial_quantity'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + + if attributes.key?(:'applied_discount_amount') + self.applied_discount_amount = attributes[:'applied_discount_amount'] + end + + if attributes.key?(:'applied_discount_quantity') + self.applied_discount_quantity = attributes[:'applied_discount_quantity'] + end + + if attributes.key?(:'applied_quantity') + self.applied_quantity = attributes[:'applied_quantity'] + end + + if attributes.key?(:'applied_quantity_amount') + self.applied_quantity_amount = attributes[:'applied_quantity_amount'] + end + + if attributes.key?(:'initial_amount') + self.initial_amount = attributes[:'initial_amount'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'subtotal_amount') + self.subtotal_amount = attributes[:'subtotal_amount'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'order_item' + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + related_object_validator = EnumAttributeValidator.new('String', ["product", "sku"]) + return false unless related_object_validator.valid?(@related_object) + object_validator = EnumAttributeValidator.new('String', ["order_item"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + sku_id == o.sku_id && + product_id == o.product_id && + related_object == o.related_object && + source_id == o.source_id && + quantity == o.quantity && + discount_quantity == o.discount_quantity && + initial_quantity == o.initial_quantity && + amount == o.amount && + discount_amount == o.discount_amount && + applied_discount_amount == o.applied_discount_amount && + applied_discount_quantity == o.applied_discount_quantity && + applied_quantity == o.applied_quantity && + applied_quantity_amount == o.applied_quantity_amount && + initial_amount == o.initial_amount && + price == o.price && + subtotal_amount == o.subtotal_amount && + product == o.product && + sku == o.sku && + object == o.object && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, sku_id, product_id, related_object, source_id, quantity, discount_quantity, initial_quantity, amount, discount_amount, applied_discount_amount, applied_discount_quantity, applied_quantity, applied_quantity_amount, initial_amount, price, subtotal_amount, product, sku, object, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/order_calculated_item_product.rb b/lib/VoucherifySdk/models/order_calculated_item_product.rb new file mode 100644 index 00000000..98370ba4 --- /dev/null +++ b/lib/VoucherifySdk/models/order_calculated_item_product.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # An object containing details of the related product. + class OrderCalculatedItemProduct + # A unique identifier that represents the product and is assigned by Voucherify. + attr_accessor :id + + # The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + attr_accessor :source_id + + # The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. + attr_accessor :override + + # Product name. + attr_accessor :name + + # A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. + attr_accessor :metadata + + # Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). + attr_accessor :price + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'override' => :'override', + :'name' => :'name', + :'metadata' => :'metadata', + :'price' => :'price' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'override' => :'Boolean', + :'name' => :'String', + :'metadata' => :'Object', + :'price' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'override', + :'name', + :'metadata', + :'price' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'override') + self.override = attributes[:'override'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + override == o.override && + name == o.name && + metadata == o.metadata && + price == o.price + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, override, name, metadata, price].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/order_calculated_item_sku.rb b/lib/VoucherifySdk/models/order_calculated_item_sku.rb new file mode 100644 index 00000000..470824f3 --- /dev/null +++ b/lib/VoucherifySdk/models/order_calculated_item_sku.rb @@ -0,0 +1,254 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # An object containing details of the related SKU. + class OrderCalculatedItemSku + # A unique identifier that represents the SKU and is assigned by Voucherify. + attr_accessor :id + + # The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + attr_accessor :source_id + + # The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. + attr_accessor :override + + # The SKU name. + attr_accessor :sku + + # SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). + attr_accessor :price + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'override' => :'override', + :'sku' => :'sku', + :'price' => :'price' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'override' => :'Boolean', + :'sku' => :'String', + :'price' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'override', + :'sku', + :'price' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'override') + self.override = attributes[:'override'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + override == o.override && + sku == o.sku && + price == o.price + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, override, sku, price].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/order_calculated_no_customer_data.rb b/lib/VoucherifySdk/models/order_calculated_no_customer_data.rb deleted file mode 100644 index cc291dd5..00000000 --- a/lib/VoucherifySdk/models/order_calculated_no_customer_data.rb +++ /dev/null @@ -1,496 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class OrderCalculatedNoCustomerData - # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. - attr_accessor :id - - # Unique source ID of an existing order that will be linked to the redemption of this request. - attr_accessor :source_id - - # Timestamp representing the date and time when the order was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the order was last updated in ISO 8601 format. - attr_accessor :updated_at - - # The order status. - attr_accessor :status - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :amount - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :initial_amount - - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - - # Sum of all product-specific discounts applied to the order. - attr_accessor :items_discount_amount - - # Sum of all order-level AND all product-specific discounts applied to the order. - attr_accessor :total_discount_amount - - # Order amount after undoing all the discounts through the rollback redemption. - attr_accessor :total_amount - - # This field shows the order-level discount applied. - attr_accessor :applied_discount_amount - - # Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` - attr_accessor :items_applied_discount_amount - - # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` - attr_accessor :total_applied_discount_amount - - # Array of items applied to the order. - attr_accessor :items - - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - # Unique referrer ID. - attr_accessor :referrer_id - - # The type of object represented by JSON. - attr_accessor :object - - attr_accessor :redemptions - - attr_accessor :customer - - attr_accessor :referrer - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'status' => :'status', - :'amount' => :'amount', - :'initial_amount' => :'initial_amount', - :'discount_amount' => :'discount_amount', - :'items_discount_amount' => :'items_discount_amount', - :'total_discount_amount' => :'total_discount_amount', - :'total_amount' => :'total_amount', - :'applied_discount_amount' => :'applied_discount_amount', - :'items_applied_discount_amount' => :'items_applied_discount_amount', - :'total_applied_discount_amount' => :'total_applied_discount_amount', - :'items' => :'items', - :'metadata' => :'metadata', - :'customer_id' => :'customer_id', - :'referrer_id' => :'referrer_id', - :'object' => :'object', - :'redemptions' => :'redemptions', - :'customer' => :'customer', - :'referrer' => :'referrer' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'status' => :'String', - :'amount' => :'Integer', - :'initial_amount' => :'Integer', - :'discount_amount' => :'Integer', - :'items_discount_amount' => :'Integer', - :'total_discount_amount' => :'Integer', - :'total_amount' => :'Integer', - :'applied_discount_amount' => :'Integer', - :'items_applied_discount_amount' => :'Integer', - :'total_applied_discount_amount' => :'Integer', - :'items' => :'Array', - :'metadata' => :'Object', - :'customer_id' => :'String', - :'referrer_id' => :'String', - :'object' => :'String', - :'redemptions' => :'Hash', - :'customer' => :'CustomerId', - :'referrer' => :'ReferrerId' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - :'updated_at', - :'customer_id', - :'referrer_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderCalculatedBase' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderCalculatedNoCustomerData` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderCalculatedNoCustomerData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'initial_amount') - self.initial_amount = attributes[:'initial_amount'] - end - - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - - if attributes.key?(:'items_discount_amount') - self.items_discount_amount = attributes[:'items_discount_amount'] - end - - if attributes.key?(:'total_discount_amount') - self.total_discount_amount = attributes[:'total_discount_amount'] - end - - if attributes.key?(:'total_amount') - self.total_amount = attributes[:'total_amount'] - end - - if attributes.key?(:'applied_discount_amount') - self.applied_discount_amount = attributes[:'applied_discount_amount'] - end - - if attributes.key?(:'items_applied_discount_amount') - self.items_applied_discount_amount = attributes[:'items_applied_discount_amount'] - end - - if attributes.key?(:'total_applied_discount_amount') - self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] - end - - if attributes.key?(:'items') - if (value = attributes[:'items']).is_a?(Array) - self.items = value - end - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - else - self.referrer_id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' - end - - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Hash) - self.redemptions = value - end - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - return false unless status_validator.valid?(@status) - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["order"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - created_at == o.created_at && - updated_at == o.updated_at && - status == o.status && - amount == o.amount && - initial_amount == o.initial_amount && - discount_amount == o.discount_amount && - items_discount_amount == o.items_discount_amount && - total_discount_amount == o.total_discount_amount && - total_amount == o.total_amount && - applied_discount_amount == o.applied_discount_amount && - items_applied_discount_amount == o.items_applied_discount_amount && - total_applied_discount_amount == o.total_applied_discount_amount && - items == o.items && - metadata == o.metadata && - customer_id == o.customer_id && - referrer_id == o.referrer_id && - object == o.object && - redemptions == o.redemptions && - customer == o.customer && - referrer == o.referrer - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, created_at, updated_at, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, customer_id, referrer_id, object, redemptions, customer, referrer].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/order_calculated_referrer.rb b/lib/VoucherifySdk/models/order_calculated_referrer.rb deleted file mode 100644 index a604e201..00000000 --- a/lib/VoucherifySdk/models/order_calculated_referrer.rb +++ /dev/null @@ -1,105 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module OrderCalculatedReferrer - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ReferrerId', - :'ReferrerWithSummaryLoyaltyReferrals' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/order_item.rb b/lib/VoucherifySdk/models/order_item.rb index 7fca8d6c..4d8230b6 100644 --- a/lib/VoucherifySdk/models/order_item.rb +++ b/lib/VoucherifySdk/models/order_item.rb @@ -15,16 +15,16 @@ module VoucherifySdk class OrderItem - # A unique SKU ID assigned by Voucherify. + # Unique identifier of the SKU. It is assigned by Voucherify. attr_accessor :sku_id - # A unique product ID assigned by Voucherify. + # Unique identifier of the product. It is assigned by Voucherify. attr_accessor :product_id # Used along with the source_id property, can be set to either sku or product. attr_accessor :related_object - # The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. + # The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. attr_accessor :source_id # The quantity of the particular item in the cart. @@ -39,7 +39,7 @@ class OrderItem # The total amount of the order item (price * quantity). attr_accessor :amount - # Sum of all order-item-level discounts applied to the order. + # Sum of all order-item-level discounts applied to the order. attr_accessor :discount_amount # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. @@ -52,7 +52,7 @@ class OrderItem attr_accessor :sku - # A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. + # A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. attr_accessor :metadata class EnumAttributeValidator @@ -125,21 +125,28 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'sku_id', + :'product_id', + :'related_object', + :'source_id', + :'quantity', + :'discount_quantity', + :'initial_quantity', + :'amount', + :'discount_amount', + :'initial_amount', + :'price', + :'product', + :'sku', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -217,16 +224,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object Object to be assigned - def related_object=(related_object) - validator = EnumAttributeValidator.new('String', ["product", "sku"]) - unless validator.valid?(related_object) - fail ArgumentError, "invalid value for \"related_object\", must be one of #{validator.allowable_values}." - end - @related_object = related_object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/order_item_calculated.rb b/lib/VoucherifySdk/models/order_item_calculated.rb deleted file mode 100644 index 10726f13..00000000 --- a/lib/VoucherifySdk/models/order_item_calculated.rb +++ /dev/null @@ -1,436 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class OrderItemCalculated - # A unique SKU ID assigned by Voucherify. - attr_accessor :sku_id - - # A unique product ID assigned by Voucherify. - attr_accessor :product_id - - # Used along with the source_id property, can be set to either sku or product. - attr_accessor :related_object - - # The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. - attr_accessor :source_id - - # The quantity of the particular item in the cart. - attr_accessor :quantity - - # Number of dicounted items. - attr_accessor :discount_quantity - - # A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. - attr_accessor :initial_quantity - - # The total amount of the order item (price * quantity). - attr_accessor :amount - - # Sum of all order-item-level discounts applied to the order. - attr_accessor :discount_amount - - # This field shows the order-level discount applied. - attr_accessor :applied_discount_amount - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :initial_amount - - # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` - attr_accessor :total_applied_discount_amount - - # Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. - attr_accessor :price - - # Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` - attr_accessor :subtotal_amount - - attr_accessor :product - - attr_accessor :sku - - # The type of object represented by JSON. - attr_accessor :object - - # A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. - attr_accessor :metadata - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'sku_id' => :'sku_id', - :'product_id' => :'product_id', - :'related_object' => :'related_object', - :'source_id' => :'source_id', - :'quantity' => :'quantity', - :'discount_quantity' => :'discount_quantity', - :'initial_quantity' => :'initial_quantity', - :'amount' => :'amount', - :'discount_amount' => :'discount_amount', - :'applied_discount_amount' => :'applied_discount_amount', - :'initial_amount' => :'initial_amount', - :'total_applied_discount_amount' => :'total_applied_discount_amount', - :'price' => :'price', - :'subtotal_amount' => :'subtotal_amount', - :'product' => :'product', - :'sku' => :'sku', - :'object' => :'object', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'sku_id' => :'String', - :'product_id' => :'String', - :'related_object' => :'String', - :'source_id' => :'String', - :'quantity' => :'Integer', - :'discount_quantity' => :'Integer', - :'initial_quantity' => :'Integer', - :'amount' => :'Integer', - :'discount_amount' => :'Integer', - :'applied_discount_amount' => :'Integer', - :'initial_amount' => :'Integer', - :'total_applied_discount_amount' => :'Integer', - :'price' => :'Integer', - :'subtotal_amount' => :'Integer', - :'product' => :'OrderItemProduct', - :'sku' => :'OrderItemSku', - :'object' => :'String', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderItemCalculated` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderItemCalculated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'sku_id') - self.sku_id = attributes[:'sku_id'] - end - - if attributes.key?(:'product_id') - self.product_id = attributes[:'product_id'] - end - - if attributes.key?(:'related_object') - self.related_object = attributes[:'related_object'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'quantity') - self.quantity = attributes[:'quantity'] - end - - if attributes.key?(:'discount_quantity') - self.discount_quantity = attributes[:'discount_quantity'] - end - - if attributes.key?(:'initial_quantity') - self.initial_quantity = attributes[:'initial_quantity'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - - if attributes.key?(:'applied_discount_amount') - self.applied_discount_amount = attributes[:'applied_discount_amount'] - end - - if attributes.key?(:'initial_amount') - self.initial_amount = attributes[:'initial_amount'] - end - - if attributes.key?(:'total_applied_discount_amount') - self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] - end - - if attributes.key?(:'price') - self.price = attributes[:'price'] - end - - if attributes.key?(:'subtotal_amount') - self.subtotal_amount = attributes[:'subtotal_amount'] - end - - if attributes.key?(:'product') - self.product = attributes[:'product'] - end - - if attributes.key?(:'sku') - self.sku = attributes[:'sku'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order_item' - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - related_object_validator = EnumAttributeValidator.new('String', ["product", "sku"]) - return false unless related_object_validator.valid?(@related_object) - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["order_item"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object Object to be assigned - def related_object=(related_object) - validator = EnumAttributeValidator.new('String', ["product", "sku"]) - unless validator.valid?(related_object) - fail ArgumentError, "invalid value for \"related_object\", must be one of #{validator.allowable_values}." - end - @related_object = related_object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order_item"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - sku_id == o.sku_id && - product_id == o.product_id && - related_object == o.related_object && - source_id == o.source_id && - quantity == o.quantity && - discount_quantity == o.discount_quantity && - initial_quantity == o.initial_quantity && - amount == o.amount && - discount_amount == o.discount_amount && - applied_discount_amount == o.applied_discount_amount && - initial_amount == o.initial_amount && - total_applied_discount_amount == o.total_applied_discount_amount && - price == o.price && - subtotal_amount == o.subtotal_amount && - product == o.product && - sku == o.sku && - object == o.object && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [sku_id, product_id, related_object, source_id, quantity, discount_quantity, initial_quantity, amount, discount_amount, applied_discount_amount, initial_amount, total_applied_discount_amount, price, subtotal_amount, product, sku, object, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/order_item_product.rb b/lib/VoucherifySdk/models/order_item_product.rb index a8b97c03..9892ef46 100644 --- a/lib/VoucherifySdk/models/order_item_product.rb +++ b/lib/VoucherifySdk/models/order_item_product.rb @@ -19,7 +19,7 @@ class OrderItemProduct # A unique identifier that represents the product and is assigned by Voucherify. attr_accessor :id - # The merchant’s product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + # The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. attr_accessor :source_id # The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. @@ -66,21 +66,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'override', + :'name', + :'metadata', + :'price' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderItemProduct` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderItemProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/order_item_sku.rb b/lib/VoucherifySdk/models/order_item_sku.rb index 6d9f6f76..a2e0e445 100644 --- a/lib/VoucherifySdk/models/order_item_sku.rb +++ b/lib/VoucherifySdk/models/order_item_sku.rb @@ -19,7 +19,7 @@ class OrderItemSku # A unique identifier that represents the SKU and is assigned by Voucherify. attr_accessor :id - # The merchant’s SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + # The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. attr_accessor :source_id # The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. @@ -61,21 +61,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'override', + :'sku', + :'price' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderItemSku` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderItemSku`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/order_redemptions.rb b/lib/VoucherifySdk/models/order_redemptions.rb deleted file mode 100644 index f5387207..00000000 --- a/lib/VoucherifySdk/models/order_redemptions.rb +++ /dev/null @@ -1,291 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class OrderRedemptions - # Timestamp representing the date and time when the redemption was created in ISO 8601 format. - attr_accessor :date - - # Unique ID of the redemption rollback. - attr_accessor :rollback_id - - # Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format. - attr_accessor :rollback_date - - # The source of the incentive. - attr_accessor :related_object_type - - # Unique ID of the parent redemption. - attr_accessor :related_object_id - - # Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. - attr_accessor :related_object_parent_id - - # Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. - attr_accessor :stacked - - # Lists the rollback redemption IDs of the particular child redemptions. - attr_accessor :rollback_stacked - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'date' => :'date', - :'rollback_id' => :'rollback_id', - :'rollback_date' => :'rollback_date', - :'related_object_type' => :'related_object_type', - :'related_object_id' => :'related_object_id', - :'related_object_parent_id' => :'related_object_parent_id', - :'stacked' => :'stacked', - :'rollback_stacked' => :'rollback_stacked' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'date' => :'Time', - :'rollback_id' => :'String', - :'rollback_date' => :'Time', - :'related_object_type' => :'String', - :'related_object_id' => :'String', - :'related_object_parent_id' => :'String', - :'stacked' => :'Array', - :'rollback_stacked' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrderRedemptions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrderRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - - if attributes.key?(:'rollback_id') - self.rollback_id = attributes[:'rollback_id'] - end - - if attributes.key?(:'rollback_date') - self.rollback_date = attributes[:'rollback_date'] - end - - if attributes.key?(:'related_object_type') - self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = 'redemption' - end - - if attributes.key?(:'related_object_id') - self.related_object_id = attributes[:'related_object_id'] - end - - if attributes.key?(:'related_object_parent_id') - self.related_object_parent_id = attributes[:'related_object_parent_id'] - end - - if attributes.key?(:'stacked') - if (value = attributes[:'stacked']).is_a?(Array) - self.stacked = value - end - end - - if attributes.key?(:'rollback_stacked') - if (value = attributes[:'rollback_stacked']).is_a?(Array) - self.rollback_stacked = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - date == o.date && - rollback_id == o.rollback_id && - rollback_date == o.rollback_date && - related_object_type == o.related_object_type && - related_object_id == o.related_object_id && - related_object_parent_id == o.related_object_parent_id && - stacked == o.stacked && - rollback_stacked == o.rollback_stacked - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [date, rollback_id, rollback_date, related_object_type, related_object_id, related_object_parent_id, stacked, rollback_stacked].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/order_redemptions_entry.rb b/lib/VoucherifySdk/models/order_redemptions_entry.rb new file mode 100644 index 00000000..52c75b20 --- /dev/null +++ b/lib/VoucherifySdk/models/order_redemptions_entry.rb @@ -0,0 +1,292 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class OrderRedemptionsEntry + # Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Unique ID of the redemption rollback. + attr_accessor :rollback_id + + # Timestamp representing the date and tiem when the redemption rollback was created. The value is shown in the ISO 8601 format. + attr_accessor :rollback_date + + # The source of the incentive. + attr_accessor :related_object_type + + # Unique ID of the parent redemption. + attr_accessor :related_object_id + + # Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. + attr_accessor :related_object_parent_id + + # Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. + attr_accessor :stacked + + # Lists the rollback redemption IDs of the particular child redemptions. + attr_accessor :rollback_stacked + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'date' => :'date', + :'rollback_id' => :'rollback_id', + :'rollback_date' => :'rollback_date', + :'related_object_type' => :'related_object_type', + :'related_object_id' => :'related_object_id', + :'related_object_parent_id' => :'related_object_parent_id', + :'stacked' => :'stacked', + :'rollback_stacked' => :'rollback_stacked' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'date' => :'Time', + :'rollback_id' => :'String', + :'rollback_date' => :'Time', + :'related_object_type' => :'String', + :'related_object_id' => :'String', + :'related_object_parent_id' => :'String', + :'stacked' => :'Array', + :'rollback_stacked' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'date', + :'rollback_id', + :'rollback_date', + :'related_object_type', + :'related_object_id', + :'related_object_parent_id', + :'stacked', + :'rollback_stacked' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'rollback_id') + self.rollback_id = attributes[:'rollback_id'] + end + + if attributes.key?(:'rollback_date') + self.rollback_date = attributes[:'rollback_date'] + end + + if attributes.key?(:'related_object_type') + self.related_object_type = attributes[:'related_object_type'] + else + self.related_object_type = 'redemption' + end + + if attributes.key?(:'related_object_id') + self.related_object_id = attributes[:'related_object_id'] + end + + if attributes.key?(:'related_object_parent_id') + self.related_object_parent_id = attributes[:'related_object_parent_id'] + end + + if attributes.key?(:'stacked') + if (value = attributes[:'stacked']).is_a?(Array) + self.stacked = value + end + end + + if attributes.key?(:'rollback_stacked') + if (value = attributes[:'rollback_stacked']).is_a?(Array) + self.rollback_stacked = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + date == o.date && + rollback_id == o.rollback_id && + rollback_date == o.rollback_date && + related_object_type == o.related_object_type && + related_object_id == o.related_object_id && + related_object_parent_id == o.related_object_parent_id && + stacked == o.stacked && + rollback_stacked == o.rollback_stacked + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [date, rollback_id, rollback_date, related_object_type, related_object_id, related_object_parent_id, stacked, rollback_stacked].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/orders_create_request_body.rb b/lib/VoucherifySdk/models/orders_create_request_body.rb index f49a0916..acf7efb6 100644 --- a/lib/VoucherifySdk/models/orders_create_request_body.rb +++ b/lib/VoucherifySdk/models/orders_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/orders`. + # Request body schema for **POST** `v1/orders`. class OrdersCreateRequestBody # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. attr_accessor :id @@ -25,30 +25,30 @@ class OrdersCreateRequestBody # The order status. attr_accessor :status - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :amount - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :initial_amount + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + # Array of items applied to the order. attr_accessor :items - attr_accessor :customer - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id + # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + attr_accessor :metadata - attr_accessor :referrer + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at # Unique referrer ID. attr_accessor :referrer_id - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata + attr_accessor :customer + + attr_accessor :referrer class EnumAttributeValidator attr_reader :datatype @@ -79,14 +79,14 @@ def self.attribute_map :'source_id' => :'source_id', :'status' => :'status', :'amount' => :'amount', - :'discount_amount' => :'discount_amount', :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', :'items' => :'items', - :'customer' => :'customer', - :'customer_id' => :'customer_id', - :'referrer' => :'referrer', + :'metadata' => :'metadata', + :'created_at' => :'created_at', :'referrer_id' => :'referrer_id', - :'metadata' => :'metadata' + :'customer' => :'customer', + :'referrer' => :'referrer' } end @@ -102,42 +102,38 @@ def self.openapi_types :'source_id' => :'String', :'status' => :'String', :'amount' => :'Integer', - :'discount_amount' => :'Integer', :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', :'items' => :'Array', - :'customer' => :'Customer', - :'customer_id' => :'String', - :'referrer' => :'Referrer', + :'metadata' => :'Object', + :'created_at' => :'Time', :'referrer_id' => :'String', - :'metadata' => :'Object' + :'customer' => :'Customer', + :'referrer' => :'Referrer' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items', + :'metadata', + :'created_at', + :'referrer_id', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Order' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -157,38 +153,38 @@ def initialize(attributes = {}) self.amount = attributes[:'amount'] end - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - if attributes.key?(:'initial_amount') self.initial_amount = attributes[:'initial_amount'] end + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] end - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end if attributes.key?(:'referrer_id') self.referrer_id = attributes[:'referrer_id'] end - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] end end @@ -209,16 +205,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -228,14 +214,14 @@ def ==(o) source_id == o.source_id && status == o.status && amount == o.amount && - discount_amount == o.discount_amount && initial_amount == o.initial_amount && + discount_amount == o.discount_amount && items == o.items && - customer == o.customer && - customer_id == o.customer_id && - referrer == o.referrer && + metadata == o.metadata && + created_at == o.created_at && referrer_id == o.referrer_id && - metadata == o.metadata + customer == o.customer && + referrer == o.referrer end # @see the `==` method @@ -247,7 +233,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, source_id, status, amount, discount_amount, initial_amount, items, customer, customer_id, referrer, referrer_id, metadata].hash + [id, source_id, status, amount, initial_amount, discount_amount, items, metadata, created_at, referrer_id, customer, referrer].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/orders_create_response_body.rb b/lib/VoucherifySdk/models/orders_create_response_body.rb index 603b1ee8..0878dcd5 100644 --- a/lib/VoucherifySdk/models/orders_create_response_body.rb +++ b/lib/VoucherifySdk/models/orders_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/orders`. + # Response body schema for **POST** `v1/orders`. class OrdersCreateResponseBody # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. attr_accessor :id @@ -22,12 +22,6 @@ class OrdersCreateResponseBody # Unique source ID of an existing order that will be linked to the redemption of this request. attr_accessor :source_id - # Timestamp representing the date and time when the order was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the order was last updated in ISO 8601 format. - attr_accessor :updated_at - # The order status. attr_accessor :status @@ -64,21 +58,27 @@ class OrdersCreateResponseBody # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. attr_accessor :metadata + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + # Unique customer ID of the customer making the purchase. attr_accessor :customer_id # Unique referrer ID. attr_accessor :referrer_id - # The type of object represented by JSON. - attr_accessor :object - - attr_accessor :redemptions - attr_accessor :customer attr_accessor :referrer + attr_accessor :redemptions + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -106,8 +106,6 @@ def self.attribute_map { :'id' => :'id', :'source_id' => :'source_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', :'status' => :'status', :'amount' => :'amount', :'initial_amount' => :'initial_amount', @@ -120,12 +118,14 @@ def self.attribute_map :'total_applied_discount_amount' => :'total_applied_discount_amount', :'items' => :'items', :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', :'customer_id' => :'customer_id', :'referrer_id' => :'referrer_id', - :'object' => :'object', - :'redemptions' => :'redemptions', :'customer' => :'customer', - :'referrer' => :'referrer' + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' } end @@ -139,8 +139,6 @@ def self.openapi_types { :'id' => :'String', :'source_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', :'status' => :'String', :'amount' => :'Integer', :'initial_amount' => :'Integer', @@ -151,46 +149,50 @@ def self.openapi_types :'applied_discount_amount' => :'Integer', :'items_applied_discount_amount' => :'Integer', :'total_applied_discount_amount' => :'Integer', - :'items' => :'Array', + :'items' => :'Array', :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', :'customer_id' => :'String', :'referrer_id' => :'String', - :'object' => :'String', - :'redemptions' => :'Hash', - :'customer' => :'OrderCalculatedCustomer', - :'referrer' => :'OrderCalculatedReferrer' + :'customer' => :'CustomerId', + :'referrer' => :'ReferrerId', + :'redemptions' => :'Hash' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'metadata', + :'object', + :'created_at', :'updated_at', :'customer_id', :'referrer_id', + :'redemptions' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderCalculated' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -200,16 +202,6 @@ def initialize(attributes = {}) if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] end if attributes.key?(:'status') @@ -262,28 +254,26 @@ def initialize(attributes = {}) self.metadata = attributes[:'metadata'] end - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'object') + self.object = attributes[:'object'] else - self.customer_id = nil + self.object = 'order' end - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - else - self.referrer_id = nil + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] end - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Hash) - self.redemptions = value - end + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'customer') @@ -293,6 +283,12 @@ def initialize(attributes = {}) if attributes.key?(:'referrer') self.referrer = attributes[:'referrer'] end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Hash) + self.redemptions = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -300,10 +296,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -313,32 +305,11 @@ def valid? warn '[DEPRECATED] the `valid?` method is obsolete' status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) return false unless status_validator.valid?(@status) - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["order"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -346,8 +317,6 @@ def ==(o) self.class == o.class && id == o.id && source_id == o.source_id && - created_at == o.created_at && - updated_at == o.updated_at && status == o.status && amount == o.amount && initial_amount == o.initial_amount && @@ -360,12 +329,14 @@ def ==(o) total_applied_discount_amount == o.total_applied_discount_amount && items == o.items && metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && customer_id == o.customer_id && referrer_id == o.referrer_id && - object == o.object && - redemptions == o.redemptions && customer == o.customer && - referrer == o.referrer + referrer == o.referrer && + redemptions == o.redemptions end # @see the `==` method @@ -377,7 +348,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, source_id, created_at, updated_at, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, customer_id, referrer_id, object, redemptions, customer, referrer].hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/orders_export_create_request_body.rb b/lib/VoucherifySdk/models/orders_export_create_request_body.rb index 67a9e494..104d0cac 100644 --- a/lib/VoucherifySdk/models/orders_export_create_request_body.rb +++ b/lib/VoucherifySdk/models/orders_export_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/orders/export`. + # Request body schema for **POST** `v1/orders/export`. class OrdersExportCreateRequestBody attr_accessor :parameters @@ -40,21 +40,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'parameters' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersExportCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersExportCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/orders_export_create_request_body_parameters.rb b/lib/VoucherifySdk/models/orders_export_create_request_body_parameters.rb index 3076f666..61b0d5a7 100644 --- a/lib/VoucherifySdk/models/orders_export_create_request_body_parameters.rb +++ b/lib/VoucherifySdk/models/orders_export_create_request_body_parameters.rb @@ -72,21 +72,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'fields', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersExportCreateRequestBodyParameters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersExportCreateRequestBodyParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/orders_export_create_response_body.rb b/lib/VoucherifySdk/models/orders_export_create_response_body.rb index 177214c3..bdd845e1 100644 --- a/lib/VoucherifySdk/models/orders_export_create_response_body.rb +++ b/lib/VoucherifySdk/models/orders_export_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/orders/export`. + # Response body schema for **POST** `v1/orders/export`. class OrdersExportCreateResponseBody # Unique export ID. attr_accessor :id @@ -95,44 +95,35 @@ def self.openapi_types :'result' => :'Object', :'user_id' => :'String', :'exported_object' => :'String', - :'parameters' => :'OrdersExportCreateRequestBodyParameters' + :'parameters' => :'OrdersExportCreateResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', :'result', + :'user_id', + :'exported_object', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ExportOrderBase', - :'ExportScheduledBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersExportCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersExportCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -143,8 +134,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'status') @@ -159,14 +148,10 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] - else - self.user_id = nil end if attributes.key?(:'exported_object') @@ -185,30 +170,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @user_id.nil? - invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - invalid_properties end @@ -216,51 +177,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["export"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) return false unless status_validator.valid?(@status) - return false if @user_id.nil? - return false if @exported_object.nil? exported_object_validator = EnumAttributeValidator.new('String', ["order"]) return false unless exported_object_validator.valid?(@exported_object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/orders_export_create_response_body_parameters.rb b/lib/VoucherifySdk/models/orders_export_create_response_body_parameters.rb new file mode 100644 index 00000000..43a00974 --- /dev/null +++ b/lib/VoucherifySdk/models/orders_export_create_response_body_parameters.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + class OrdersExportCreateResponseBodyParameters + attr_accessor :order + + # Array of strings containing the data in the export. These fields define the headers in the CSV file. + attr_accessor :fields + + # Allowed additional properties must start with \"metadata.\" + attr_accessor :filters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order', + :'fields' => :'fields', + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'ExportOrderOrder', + :'fields' => :'Array', + :'filters' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'fields', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = value + end + end + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + order == o.order && + fields == o.fields && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order, fields, filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/orders_get_response_body.rb b/lib/VoucherifySdk/models/orders_get_response_body.rb index f8f737c1..51e078b6 100644 --- a/lib/VoucherifySdk/models/orders_get_response_body.rb +++ b/lib/VoucherifySdk/models/orders_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/orders/{orderId}`. + # Response body schema for **GET** `v1/orders/{orderId}`. class OrdersGetResponseBody # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. attr_accessor :id @@ -22,12 +22,6 @@ class OrdersGetResponseBody # Unique source ID of an existing order that will be linked to the redemption of this request. attr_accessor :source_id - # Timestamp representing the date and time when the order was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the order was last updated in ISO 8601 format. - attr_accessor :updated_at - # The order status. attr_accessor :status @@ -64,21 +58,27 @@ class OrdersGetResponseBody # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. attr_accessor :metadata + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + # Unique customer ID of the customer making the purchase. attr_accessor :customer_id # Unique referrer ID. attr_accessor :referrer_id - # The type of object represented by JSON. - attr_accessor :object - - attr_accessor :redemptions - attr_accessor :customer attr_accessor :referrer + attr_accessor :redemptions + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -106,8 +106,6 @@ def self.attribute_map { :'id' => :'id', :'source_id' => :'source_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', :'status' => :'status', :'amount' => :'amount', :'initial_amount' => :'initial_amount', @@ -120,12 +118,14 @@ def self.attribute_map :'total_applied_discount_amount' => :'total_applied_discount_amount', :'items' => :'items', :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', :'customer_id' => :'customer_id', :'referrer_id' => :'referrer_id', - :'object' => :'object', - :'redemptions' => :'redemptions', :'customer' => :'customer', - :'referrer' => :'referrer' + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' } end @@ -139,8 +139,6 @@ def self.openapi_types { :'id' => :'String', :'source_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', :'status' => :'String', :'amount' => :'Integer', :'initial_amount' => :'Integer', @@ -151,46 +149,50 @@ def self.openapi_types :'applied_discount_amount' => :'Integer', :'items_applied_discount_amount' => :'Integer', :'total_applied_discount_amount' => :'Integer', - :'items' => :'Array', + :'items' => :'Array', :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', :'customer_id' => :'String', :'referrer_id' => :'String', - :'object' => :'String', - :'redemptions' => :'Hash', :'customer' => :'CustomerId', - :'referrer' => :'ReferrerId' + :'referrer' => :'ReferrerId', + :'redemptions' => :'Hash' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'metadata', + :'object', + :'created_at', :'updated_at', :'customer_id', :'referrer_id', + :'redemptions' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderCalculatedNoCustomerData' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -200,16 +202,6 @@ def initialize(attributes = {}) if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] end if attributes.key?(:'status') @@ -262,28 +254,26 @@ def initialize(attributes = {}) self.metadata = attributes[:'metadata'] end - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'object') + self.object = attributes[:'object'] else - self.customer_id = nil + self.object = 'order' end - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - else - self.referrer_id = nil + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] end - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Hash) - self.redemptions = value - end + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'customer') @@ -293,6 +283,12 @@ def initialize(attributes = {}) if attributes.key?(:'referrer') self.referrer = attributes[:'referrer'] end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Hash) + self.redemptions = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -300,10 +296,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -313,32 +305,11 @@ def valid? warn '[DEPRECATED] the `valid?` method is obsolete' status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) return false unless status_validator.valid?(@status) - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["order"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -346,8 +317,6 @@ def ==(o) self.class == o.class && id == o.id && source_id == o.source_id && - created_at == o.created_at && - updated_at == o.updated_at && status == o.status && amount == o.amount && initial_amount == o.initial_amount && @@ -360,12 +329,14 @@ def ==(o) total_applied_discount_amount == o.total_applied_discount_amount && items == o.items && metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && customer_id == o.customer_id && referrer_id == o.referrer_id && - object == o.object && - redemptions == o.redemptions && customer == o.customer && - referrer == o.referrer + referrer == o.referrer && + redemptions == o.redemptions end # @see the `==` method @@ -377,7 +348,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, source_id, created_at, updated_at, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, customer_id, referrer_id, object, redemptions, customer, referrer].hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/orders_import_create_request_body_item.rb b/lib/VoucherifySdk/models/orders_import_create_request_body_item.rb index 54b32761..3b4a4f54 100644 --- a/lib/VoucherifySdk/models/orders_import_create_request_body_item.rb +++ b/lib/VoucherifySdk/models/orders_import_create_request_body_item.rb @@ -15,36 +15,39 @@ module VoucherifySdk class OrdersImportCreateRequestBodyItem + # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + attr_accessor :id + + # Unique source ID of an existing order that will be linked to the redemption of this request. + attr_accessor :source_id + # The order status. attr_accessor :status - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :amount - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :initial_amount + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + # Array of items applied to the order. attr_accessor :items - attr_accessor :customer + # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + attr_accessor :metadata - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - attr_accessor :referrer + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at # Unique referrer ID. attr_accessor :referrer_id - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata + attr_accessor :customer - # Unique source ID of an existing order that will be linked to the redemption of this request. - attr_accessor :source_id + attr_accessor :referrer class EnumAttributeValidator attr_reader :datatype @@ -71,17 +74,18 @@ def valid?(value) # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'id' => :'id', + :'source_id' => :'source_id', :'status' => :'status', :'amount' => :'amount', - :'discount_amount' => :'discount_amount', :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', :'items' => :'items', - :'customer' => :'customer', - :'customer_id' => :'customer_id', - :'referrer' => :'referrer', - :'referrer_id' => :'referrer_id', :'metadata' => :'metadata', - :'source_id' => :'source_id' + :'created_at' => :'created_at', + :'referrer_id' => :'referrer_id', + :'customer' => :'customer', + :'referrer' => :'referrer' } end @@ -93,48 +97,59 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'id' => :'String', + :'source_id' => :'String', :'status' => :'String', :'amount' => :'Integer', - :'discount_amount' => :'Integer', :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', :'items' => :'Array', - :'customer' => :'Customer', - :'customer_id' => :'String', - :'referrer' => :'Referrer', - :'referrer_id' => :'String', :'metadata' => :'Object', - :'source_id' => :'String' + :'created_at' => :'Time', + :'referrer_id' => :'String', + :'customer' => :'Customer', + :'referrer' => :'Referrer' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items', + :'metadata', + :'referrer_id', ]) end # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ - :'OrderBase' + :'Order' ] end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersImportCreateRequestBodyItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersImportCreateRequestBodyItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] end @@ -143,42 +158,38 @@ def initialize(attributes = {}) self.amount = attributes[:'amount'] end - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - if attributes.key?(:'initial_amount') self.initial_amount = attributes[:'initial_amount'] end + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] end - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end if attributes.key?(:'referrer_id') self.referrer_id = attributes[:'referrer_id'] end - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] end - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] end end @@ -199,32 +210,23 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + id == o.id && + source_id == o.source_id && status == o.status && amount == o.amount && - discount_amount == o.discount_amount && initial_amount == o.initial_amount && + discount_amount == o.discount_amount && items == o.items && - customer == o.customer && - customer_id == o.customer_id && - referrer == o.referrer && - referrer_id == o.referrer_id && metadata == o.metadata && - source_id == o.source_id + created_at == o.created_at && + referrer_id == o.referrer_id && + customer == o.customer && + referrer == o.referrer end # @see the `==` method @@ -236,7 +238,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [status, amount, discount_amount, initial_amount, items, customer, customer_id, referrer, referrer_id, metadata, source_id].hash + [id, source_id, status, amount, initial_amount, discount_amount, items, metadata, created_at, referrer_id, customer, referrer].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/orders_import_create_response_body.rb b/lib/VoucherifySdk/models/orders_import_create_response_body.rb index 69cebbbb..4ab3f0c0 100644 --- a/lib/VoucherifySdk/models/orders_import_create_response_body.rb +++ b/lib/VoucherifySdk/models/orders_import_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/orders/import`. + # Response body schema for **POST** `v1/orders/import`. class OrdersImportCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersImportCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersImportCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/orders_list_response_body.rb b/lib/VoucherifySdk/models/orders_list_response_body.rb index 10815c4a..1190936c 100644 --- a/lib/VoucherifySdk/models/orders_list_response_body.rb +++ b/lib/VoucherifySdk/models/orders_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema representing **GET** `/orders`. + # Response body schema representing **GET** `v1/orders`. class OrdersListResponseBody - # The type of object represented by JSON. This object stores information about orders in a dictionary. + # The type of the object represented by JSON. This object stores information about orders in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of order objects. @@ -70,7 +70,7 @@ def self.openapi_types { :'object' => :'String', :'data_ref' => :'String', - :'orders' => :'Array', + :'orders' => :'Array', :'total' => :'Integer' } end @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'orders', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'orders']).is_a?(Array) self.orders = value end - else - self.orders = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,22 +121,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @orders.nil? - invalid_properties.push('invalid value for "orders", orders cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -151,37 +128,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["orders"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @orders.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["orders"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/orders_update_request_body.rb b/lib/VoucherifySdk/models/orders_update_request_body.rb index 93243e38..004f619a 100644 --- a/lib/VoucherifySdk/models/orders_update_request_body.rb +++ b/lib/VoucherifySdk/models/orders_update_request_body.rb @@ -14,35 +14,38 @@ require 'time' module VoucherifySdk - # Request body schema for **PUT** `/orders/{orderId}`. + # Request body schema for **PUT** `v1/orders/{orderId}`. class OrdersUpdateRequestBody + # Unique source ID of an existing order that will be linked to the redemption of this request. + attr_accessor :source_id + # The order status. attr_accessor :status - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :amount - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. attr_accessor :initial_amount + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + # Array of items applied to the order. attr_accessor :items - attr_accessor :customer - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id + # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + attr_accessor :metadata - attr_accessor :referrer + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at # Unique referrer ID. attr_accessor :referrer_id - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata + attr_accessor :customer + + attr_accessor :referrer class EnumAttributeValidator attr_reader :datatype @@ -69,16 +72,17 @@ def valid?(value) # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'source_id' => :'source_id', :'status' => :'status', :'amount' => :'amount', - :'discount_amount' => :'discount_amount', :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', :'items' => :'items', - :'customer' => :'customer', - :'customer_id' => :'customer_id', - :'referrer' => :'referrer', + :'metadata' => :'metadata', + :'created_at' => :'created_at', :'referrer_id' => :'referrer_id', - :'metadata' => :'metadata' + :'customer' => :'customer', + :'referrer' => :'referrer' } end @@ -90,47 +94,47 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'source_id' => :'String', :'status' => :'String', :'amount' => :'Integer', - :'discount_amount' => :'Integer', :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', :'items' => :'Array', - :'customer' => :'Customer', - :'customer_id' => :'String', - :'referrer' => :'Referrer', + :'metadata' => :'Object', + :'created_at' => :'Time', :'referrer_id' => :'String', - :'metadata' => :'Object' + :'customer' => :'Customer', + :'referrer' => :'Referrer' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items', + :'metadata', + :'created_at', + :'referrer_id', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] end @@ -139,38 +143,38 @@ def initialize(attributes = {}) self.amount = attributes[:'amount'] end - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - if attributes.key?(:'initial_amount') self.initial_amount = attributes[:'initial_amount'] end + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] end - if attributes.key?(:'referrer') - self.referrer = attributes[:'referrer'] + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end if attributes.key?(:'referrer_id') self.referrer_id = attributes[:'referrer_id'] end - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] end end @@ -191,31 +195,22 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + source_id == o.source_id && status == o.status && amount == o.amount && - discount_amount == o.discount_amount && initial_amount == o.initial_amount && + discount_amount == o.discount_amount && items == o.items && - customer == o.customer && - customer_id == o.customer_id && - referrer == o.referrer && + metadata == o.metadata && + created_at == o.created_at && referrer_id == o.referrer_id && - metadata == o.metadata + customer == o.customer && + referrer == o.referrer end # @see the `==` method @@ -227,7 +222,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [status, amount, discount_amount, initial_amount, items, customer, customer_id, referrer, referrer_id, metadata].hash + [source_id, status, amount, initial_amount, discount_amount, items, metadata, created_at, referrer_id, customer, referrer].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/orders_update_response_body.rb b/lib/VoucherifySdk/models/orders_update_response_body.rb index fafdd179..49fad6d9 100644 --- a/lib/VoucherifySdk/models/orders_update_response_body.rb +++ b/lib/VoucherifySdk/models/orders_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/orders/{orderId}`. + # Response body schema for **PUT** `v1/orders/{orderId}`. class OrdersUpdateResponseBody # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. attr_accessor :id @@ -22,12 +22,6 @@ class OrdersUpdateResponseBody # Unique source ID of an existing order that will be linked to the redemption of this request. attr_accessor :source_id - # Timestamp representing the date and time when the order was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the order was last updated in ISO 8601 format. - attr_accessor :updated_at - # The order status. attr_accessor :status @@ -64,21 +58,27 @@ class OrdersUpdateResponseBody # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. attr_accessor :metadata + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + # Unique customer ID of the customer making the purchase. attr_accessor :customer_id # Unique referrer ID. attr_accessor :referrer_id - # The type of object represented by JSON. - attr_accessor :object - - attr_accessor :redemptions - attr_accessor :customer attr_accessor :referrer + attr_accessor :redemptions + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -106,8 +106,6 @@ def self.attribute_map { :'id' => :'id', :'source_id' => :'source_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', :'status' => :'status', :'amount' => :'amount', :'initial_amount' => :'initial_amount', @@ -120,12 +118,14 @@ def self.attribute_map :'total_applied_discount_amount' => :'total_applied_discount_amount', :'items' => :'items', :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', :'customer_id' => :'customer_id', :'referrer_id' => :'referrer_id', - :'object' => :'object', - :'redemptions' => :'redemptions', :'customer' => :'customer', - :'referrer' => :'referrer' + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' } end @@ -139,8 +139,6 @@ def self.openapi_types { :'id' => :'String', :'source_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', :'status' => :'String', :'amount' => :'Integer', :'initial_amount' => :'Integer', @@ -151,46 +149,50 @@ def self.openapi_types :'applied_discount_amount' => :'Integer', :'items_applied_discount_amount' => :'Integer', :'total_applied_discount_amount' => :'Integer', - :'items' => :'Array', + :'items' => :'Array', :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', :'customer_id' => :'String', :'referrer_id' => :'String', - :'object' => :'String', - :'redemptions' => :'Hash', - :'customer' => :'OrderCalculatedCustomer', - :'referrer' => :'OrderCalculatedReferrer' + :'customer' => :'CustomerId', + :'referrer' => :'ReferrerId', + :'redemptions' => :'Hash' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'metadata', + :'object', + :'created_at', :'updated_at', :'customer_id', :'referrer_id', + :'redemptions' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'OrderCalculated' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::OrdersUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::OrdersUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -200,16 +202,6 @@ def initialize(attributes = {}) if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] end if attributes.key?(:'status') @@ -262,28 +254,26 @@ def initialize(attributes = {}) self.metadata = attributes[:'metadata'] end - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] + if attributes.key?(:'object') + self.object = attributes[:'object'] else - self.customer_id = nil + self.object = 'order' end - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - else - self.referrer_id = nil + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] end - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] end - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Hash) - self.redemptions = value - end + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'customer') @@ -293,6 +283,12 @@ def initialize(attributes = {}) if attributes.key?(:'referrer') self.referrer = attributes[:'referrer'] end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Hash) + self.redemptions = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -300,10 +296,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -313,32 +305,11 @@ def valid? warn '[DEPRECATED] the `valid?` method is obsolete' status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) return false unless status_validator.valid?(@status) - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["order"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -346,8 +317,6 @@ def ==(o) self.class == o.class && id == o.id && source_id == o.source_id && - created_at == o.created_at && - updated_at == o.updated_at && status == o.status && amount == o.amount && initial_amount == o.initial_amount && @@ -360,12 +329,14 @@ def ==(o) total_applied_discount_amount == o.total_applied_discount_amount && items == o.items && metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && customer_id == o.customer_id && referrer_id == o.referrer_id && - object == o.object && - redemptions == o.redemptions && customer == o.customer && - referrer == o.referrer + referrer == o.referrer && + redemptions == o.redemptions end # @see the `==` method @@ -377,7 +348,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, source_id, created_at, updated_at, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, customer_id, referrer_id, object, redemptions, customer, referrer].hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/parameter_activity_category.rb b/lib/VoucherifySdk/models/parameter_activity_category.rb new file mode 100644 index 00000000..9d97db22 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_activity_category.rb @@ -0,0 +1,40 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterActivityCategory + ACTION = "ACTION".freeze + EFFECT = "EFFECT".freeze + + def self.all_vars + @all_vars ||= [ACTION, EFFECT].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterActivityCategory.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterActivityCategory" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_created_before_after.rb b/lib/VoucherifySdk/models/parameter_created_before_after.rb index 5bd54de1..0a326045 100644 --- a/lib/VoucherifySdk/models/parameter_created_before_after.rb +++ b/lib/VoucherifySdk/models/parameter_created_before_after.rb @@ -15,10 +15,10 @@ module VoucherifySdk class ParameterCreatedBeforeAfter - # Timestamp representing the date and time before the voucher was created in ISO 8601 format. + # Timestamp representing the date and time before the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :before - # Timestamp representing the date and time after the voucher was created in ISO 8601 format. + # Timestamp representing the date and time after the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :after # Attribute mapping from ruby-style variable name to JSON key. @@ -45,21 +45,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'before', + :'after' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterCreatedBeforeAfter` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterCreatedBeforeAfter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables.rb new file mode 100644 index 00000000..8528539e --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables.rb @@ -0,0 +1,278 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterFiltersListCustomerRedeemables + attr_accessor :id + + attr_accessor :created_at + + attr_accessor :redeemable_id + + attr_accessor :redeemable_object + + attr_accessor :holder_role + + attr_accessor :campaign_id + + attr_accessor :campaign_type + + attr_accessor :voucher_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'redeemable_id' => :'redeemable_id', + :'redeemable_object' => :'redeemable_object', + :'holder_role' => :'holder_role', + :'campaign_id' => :'campaign_id', + :'campaign_type' => :'campaign_type', + :'voucher_type' => :'voucher_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'ParameterFiltersListCustomerRedeemablesId', + :'created_at' => :'ParameterFiltersListCustomerRedeemablesCreatedAt', + :'redeemable_id' => :'ParameterFiltersListCustomerRedeemablesRedeemableId', + :'redeemable_object' => :'ParameterFiltersListCustomerRedeemablesRedeemableObject', + :'holder_role' => :'ParameterFiltersListCustomerRedeemablesHolderRole', + :'campaign_id' => :'ParameterFiltersListCustomerRedeemablesCampaignId', + :'campaign_type' => :'ParameterFiltersListCustomerRedeemablesCampaignType', + :'voucher_type' => :'ParameterFiltersListCustomerRedeemablesVoucherType' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'redeemable_id', + :'redeemable_object', + :'holder_role', + :'campaign_id', + :'campaign_type', + :'voucher_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'redeemable_id') + self.redeemable_id = attributes[:'redeemable_id'] + end + + if attributes.key?(:'redeemable_object') + self.redeemable_object = attributes[:'redeemable_object'] + end + + if attributes.key?(:'holder_role') + self.holder_role = attributes[:'holder_role'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + end + + if attributes.key?(:'voucher_type') + self.voucher_type = attributes[:'voucher_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + redeemable_id == o.redeemable_id && + redeemable_object == o.redeemable_object && + holder_role == o.holder_role && + campaign_id == o.campaign_id && + campaign_type == o.campaign_type && + voucher_type == o.voucher_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, redeemable_id, redeemable_object, holder_role, campaign_id, campaign_type, voucher_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_id.rb new file mode 100644 index 00000000..a392d87c --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_id.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Unique campaign identifer, e.g. `camp_bfrwAVsP6Q1EM1ZjgHwheKYr`. + class ParameterFiltersListCustomerRedeemablesCampaignId + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'FilterConditionsString', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type.rb new file mode 100644 index 00000000..c7c582d7 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Type of the campaign. Allowed values: `DISCOUNT_COUPONS`, `REFERRAL_PROGRAM`, `GIFT_VOUCHERS`, `LOYALTY_PROGRAM` + class ParameterFiltersListCustomerRedeemablesCampaignType + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'ParameterFiltersListCustomerRedeemablesCampaignTypeConditions', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type_conditions.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type_conditions.rb new file mode 100644 index 00000000..c2dc7792 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type_conditions.rb @@ -0,0 +1,316 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterFiltersListCustomerRedeemablesCampaignTypeConditions + # Array of resource values that should be included in the results (multiple values). + attr_accessor :_in + + # Array of resource values that should be included in the results (multiple values). + attr_accessor :not_in + + # Value is exactly this value (single value). + attr_accessor :is + + # Results omit this value (single value). + attr_accessor :is_not + + # Value is NOT null. The value for this parameter is an empty string. + attr_accessor :has_value + + # Value is null. The value for this parameter is an empty string. + attr_accessor :is_unknown + + # Value starts with the specified string. + attr_accessor :starts_with + + # Value ends with the specified string. + attr_accessor :ends_with + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not', + :'has_value' => :'$has_value', + :'is_unknown' => :'$is_unknown', + :'starts_with' => :'$starts_with', + :'ends_with' => :'$ends_with' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String', + :'has_value' => :'String', + :'is_unknown' => :'String', + :'starts_with' => :'String', + :'ends_with' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not', + :'has_value', + :'is_unknown', + :'starts_with', + :'ends_with' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + + if attributes.key?(:'has_value') + self.has_value = attributes[:'has_value'] + end + + if attributes.key?(:'is_unknown') + self.is_unknown = attributes[:'is_unknown'] + end + + if attributes.key?(:'starts_with') + self.starts_with = attributes[:'starts_with'] + end + + if attributes.key?(:'ends_with') + self.ends_with = attributes[:'ends_with'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + is_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "REFERRAL_PROGRAM"]) + return false unless is_validator.valid?(@is) + is_not_validator = EnumAttributeValidator.new('String', ["LOYALTY_PROGRAM", "GIFT_VOUCHERS", "DISCOUNT_COUPONS", "REFERRAL_PROGRAM"]) + return false unless is_not_validator.valid?(@is_not) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not && + has_value == o.has_value && + is_unknown == o.is_unknown && + starts_with == o.starts_with && + ends_with == o.ends_with + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not, has_value, is_unknown, starts_with, ends_with].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at.rb new file mode 100644 index 00000000..ebd6c0f0 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at.rb @@ -0,0 +1,240 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Timestamp representing the date and time when the customer redeemable was created. The value is shown in the ISO 8601 format. + class ParameterFiltersListCustomerRedeemablesCreatedAt + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'ParameterFiltersListCustomerRedeemablesCreatedAtConditions', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at_conditions.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at_conditions.rb new file mode 100644 index 00000000..dfe9885b --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_created_at_conditions.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class ParameterFiltersListCustomerRedeemablesCreatedAtConditions + # Value is after this date. The value for this parameter is shown in the ISO 8601 format. + attr_accessor :after + + # Value is before this date. The value for this parameter is shown in the ISO 8601 format. + attr_accessor :before + + # Value is NOT null. The value for this parameter is an empty string. + attr_accessor :has_value + + # Value is null. The value for this parameter is an empty string. + attr_accessor :is_unknown + + # Value is more days ago before the current date and time, e.g. more than `10` days ago. + attr_accessor :more_than + + # Value is less days before the current date and time, e.g. less than `10` days ago. + attr_accessor :less_than + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'after' => :'$after', + :'before' => :'$before', + :'has_value' => :'$has_value', + :'is_unknown' => :'$is_unknown', + :'more_than' => :'more_than', + :'less_than' => :'less_than' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'after' => :'Time', + :'before' => :'Time', + :'has_value' => :'String', + :'is_unknown' => :'String', + :'more_than' => :'Integer', + :'less_than' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'after', + :'before', + :'has_value', + :'is_unknown', + :'more_than', + :'less_than' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'after') + self.after = attributes[:'after'] + end + + if attributes.key?(:'before') + self.before = attributes[:'before'] + end + + if attributes.key?(:'has_value') + self.has_value = attributes[:'has_value'] + end + + if attributes.key?(:'is_unknown') + self.is_unknown = attributes[:'is_unknown'] + end + + if attributes.key?(:'more_than') + self.more_than = attributes[:'more_than'] + end + + if attributes.key?(:'less_than') + self.less_than = attributes[:'less_than'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + after == o.after && + before == o.before && + has_value == o.has_value && + is_unknown == o.is_unknown && + more_than == o.more_than && + less_than == o.less_than + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [after, before, has_value, is_unknown, more_than, less_than].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role.rb new file mode 100644 index 00000000..2828ec38 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Holder role of the redeemable. Allowed values: `OWNER`, `REFEREE`, `REFERRER`. + class ParameterFiltersListCustomerRedeemablesHolderRole + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'ParameterFiltersListCustomerRedeemablesHolderRoleConditions', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role_conditions.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role_conditions.rb new file mode 100644 index 00000000..cc09f86d --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_holder_role_conditions.rb @@ -0,0 +1,316 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterFiltersListCustomerRedeemablesHolderRoleConditions + # Array of resource values that should be included in the results (multiple values). + attr_accessor :_in + + # Array of resource values that should be included in the results (multiple values). + attr_accessor :not_in + + # Value is exactly this value (single value). + attr_accessor :is + + # Results omit this value (single value). + attr_accessor :is_not + + # Value is NOT null. The value for this parameter is an empty string. + attr_accessor :has_value + + # Value is null. The value for this parameter is an empty string. + attr_accessor :is_unknown + + # Value starts with the specified string. + attr_accessor :starts_with + + # Value ends with the specified string. + attr_accessor :ends_with + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not', + :'has_value' => :'$has_value', + :'is_unknown' => :'$is_unknown', + :'starts_with' => :'$starts_with', + :'ends_with' => :'$ends_with' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String', + :'has_value' => :'String', + :'is_unknown' => :'String', + :'starts_with' => :'String', + :'ends_with' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not', + :'has_value', + :'is_unknown', + :'starts_with', + :'ends_with' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + + if attributes.key?(:'has_value') + self.has_value = attributes[:'has_value'] + end + + if attributes.key?(:'is_unknown') + self.is_unknown = attributes[:'is_unknown'] + end + + if attributes.key?(:'starts_with') + self.starts_with = attributes[:'starts_with'] + end + + if attributes.key?(:'ends_with') + self.ends_with = attributes[:'ends_with'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + is_validator = EnumAttributeValidator.new('String', ["OWNER", "REFEREE", "REFERRER"]) + return false unless is_validator.valid?(@is) + is_not_validator = EnumAttributeValidator.new('String', ["OWNER", "REFEREE", "REFERRER"]) + return false unless is_not_validator.valid?(@is_not) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not && + has_value == o.has_value && + is_unknown == o.is_unknown && + starts_with == o.starts_with && + ends_with == o.ends_with + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not, has_value, is_unknown, starts_with, ends_with].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_id.rb new file mode 100644 index 00000000..f645e8ac --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_id.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Unique redeemable holder ID, i.e. `rh_0e77502f84f0f4a6a8`. + class ParameterFiltersListCustomerRedeemablesId + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'FilterConditionsString', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_id.rb new file mode 100644 index 00000000..c780c410 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_id.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Unique redeemable ID, e.g. `v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk`. + class ParameterFiltersListCustomerRedeemablesRedeemableId + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'FilterConditionsString', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object.rb new file mode 100644 index 00000000..2c18332d --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Unique related object, i.e. `voucher`. + class ParameterFiltersListCustomerRedeemablesRedeemableObject + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions.rb new file mode 100644 index 00000000..63b80f15 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions.rb @@ -0,0 +1,320 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions + # Array of resource values that should be included in the results (multiple values). + attr_accessor :_in + + # Array of resource values that should be included in the results (multiple values). + attr_accessor :not_in + + # Value is exactly this value (single value). + attr_accessor :is + + # Results omit this value (single value). + attr_accessor :is_not + + # Value is NOT null. The value for this parameter is an empty string. + attr_accessor :has_value + + # Value is null. The value for this parameter is an empty string. + attr_accessor :is_unknown + + # Value starts with the specified string. + attr_accessor :starts_with + + # Value ends with the specified string. + attr_accessor :ends_with + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not', + :'has_value' => :'$has_value', + :'is_unknown' => :'$is_unknown', + :'starts_with' => :'$starts_with', + :'ends_with' => :'$ends_with' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String', + :'has_value' => :'String', + :'is_unknown' => :'String', + :'starts_with' => :'String', + :'ends_with' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not', + :'has_value', + :'is_unknown', + :'starts_with', + :'ends_with' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + else + self.is = 'voucher' + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + else + self.is_not = 'voucher' + end + + if attributes.key?(:'has_value') + self.has_value = attributes[:'has_value'] + end + + if attributes.key?(:'is_unknown') + self.is_unknown = attributes[:'is_unknown'] + end + + if attributes.key?(:'starts_with') + self.starts_with = attributes[:'starts_with'] + end + + if attributes.key?(:'ends_with') + self.ends_with = attributes[:'ends_with'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + is_validator = EnumAttributeValidator.new('String', ["voucher"]) + return false unless is_validator.valid?(@is) + is_not_validator = EnumAttributeValidator.new('String', ["voucher"]) + return false unless is_not_validator.valid?(@is_not) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not && + has_value == o.has_value && + is_unknown == o.is_unknown && + starts_with == o.starts_with && + ends_with == o.ends_with + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not, has_value, is_unknown, starts_with, ends_with].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type.rb new file mode 100644 index 00000000..7c3be206 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type.rb @@ -0,0 +1,239 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Type of the voucher. Allowed values: `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD`. + class ParameterFiltersListCustomerRedeemablesVoucherType + attr_accessor :conditions + + attr_accessor :junction + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions', + :'junction' => :'junction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'ParameterFiltersListCustomerRedeemablesVoucherTypeConditions', + :'junction' => :'Junction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + junction == o.junction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions, junction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type_conditions.rb b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type_conditions.rb new file mode 100644 index 00000000..e494357a --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_voucher_type_conditions.rb @@ -0,0 +1,316 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterFiltersListCustomerRedeemablesVoucherTypeConditions + # Array of resource values that should be included in the results (multiple values). + attr_accessor :_in + + # Array of resource values that should be included in the results (multiple values). + attr_accessor :not_in + + # Value is exactly this value (single value). + attr_accessor :is + + # Results omit this value (single value). + attr_accessor :is_not + + # Value is NOT null. The value for this parameter is an empty string. + attr_accessor :has_value + + # Value is null. The value for this parameter is an empty string. + attr_accessor :is_unknown + + # Value starts with the specified string. + attr_accessor :starts_with + + # Value ends with the specified string. + attr_accessor :ends_with + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_in' => :'$in', + :'not_in' => :'$not_in', + :'is' => :'$is', + :'is_not' => :'$is_not', + :'has_value' => :'$has_value', + :'is_unknown' => :'$is_unknown', + :'starts_with' => :'$starts_with', + :'ends_with' => :'$ends_with' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_in' => :'Array', + :'not_in' => :'Array', + :'is' => :'String', + :'is_not' => :'String', + :'has_value' => :'String', + :'is_unknown' => :'String', + :'starts_with' => :'String', + :'ends_with' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'_in', + :'not_in', + :'is', + :'is_not', + :'has_value', + :'is_unknown', + :'starts_with', + :'ends_with' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + + if attributes.key?(:'is') + self.is = attributes[:'is'] + end + + if attributes.key?(:'is_not') + self.is_not = attributes[:'is_not'] + end + + if attributes.key?(:'has_value') + self.has_value = attributes[:'has_value'] + end + + if attributes.key?(:'is_unknown') + self.is_unknown = attributes[:'is_unknown'] + end + + if attributes.key?(:'starts_with') + self.starts_with = attributes[:'starts_with'] + end + + if attributes.key?(:'ends_with') + self.ends_with = attributes[:'ends_with'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + is_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless is_validator.valid?(@is) + is_not_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless is_not_validator.valid?(@is_not) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _in == o._in && + not_in == o.not_in && + is == o.is && + is_not == o.is_not && + has_value == o.has_value && + is_unknown == o.is_unknown && + starts_with == o.starts_with && + ends_with == o.ends_with + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_in, not_in, is, is_not, has_value, is_unknown, starts_with, ends_with].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions.rb index 3f2b0c32..e5ac3a29 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions.rb @@ -75,21 +75,24 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'voucher_code', + :'related_object_id', + :'related_object_parent_id', + :'parent_redemption_id', + :'failure_code', + :'result', + :'object', + :'customer_id', + :'campaign_name', + :'user_login' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_campaign_name.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_campaign_name.rb index 952fe3c6..fa7d7832 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_campaign_name.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_campaign_name.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsCampaignName` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsCampaignName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_customer_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_customer_id.rb index c3df8c50..9dde65f2 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_customer_id.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_customer_id.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsCustomerId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsCustomerId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_failure_code.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_failure_code.rb index 65820356..011b442a 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_failure_code.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_failure_code.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsFailureCode` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsFailureCode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_object.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_object.rb index df278844..d232d6cc 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_object.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_object.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsObject` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_parent_redemption_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_parent_redemption_id.rb index e2481483..cef764af 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_parent_redemption_id.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_parent_redemption_id.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsParentRedemptionId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsParentRedemptionId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_id.rb index 3ae731ef..22166208 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_id.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_id.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsRelatedObjectId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsRelatedObjectId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_parent_id.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_parent_id.rb index 635a8a72..ab6496bf 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_parent_id.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_related_object_parent_id.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsRelatedObjectParentId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsRelatedObjectParentId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_result.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_result.rb index 3e3fb1d5..e01fc32e 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_result.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_result.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsResult` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_user_login.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_user_login.rb index af9b8ac7..43bfd438 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_user_login.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_user_login.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsUserLogin` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsUserLogin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_voucher_code.rb b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_voucher_code.rb index bdf6579a..50d79a63 100644 --- a/lib/VoucherifySdk/models/parameter_filters_list_redemptions_voucher_code.rb +++ b/lib/VoucherifySdk/models/parameter_filters_list_redemptions_voucher_code.rb @@ -72,15 +72,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterFiltersListRedemptionsVoucherCode` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterFiltersListRedemptionsVoucherCode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/parameter_order_created_at.rb b/lib/VoucherifySdk/models/parameter_order_created_at.rb new file mode 100644 index 00000000..02d8f570 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_order_created_at.rb @@ -0,0 +1,40 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterOrderCreatedAt + CREATED_AT = "created_at".freeze + CREATED_AT2 = "-created_at".freeze + + def self.all_vars + @all_vars ||= [CREATED_AT, CREATED_AT2].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterOrderCreatedAt.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterOrderCreatedAt" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_order_list_earning_rules.rb b/lib/VoucherifySdk/models/parameter_order_list_earning_rules.rb new file mode 100644 index 00000000..d9d911f2 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_order_list_earning_rules.rb @@ -0,0 +1,42 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterOrderListEarningRules + CREATED_AT = "created_at".freeze + CREATED_AT2 = "-created_at".freeze + UPDATED_AT = "updated_at".freeze + UPDATED_AT2 = "-updated_at".freeze + + def self.all_vars + @all_vars ||= [CREATED_AT, CREATED_AT2, UPDATED_AT, UPDATED_AT2].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterOrderListEarningRules.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterOrderListEarningRules" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_order_list_promotion_tiers.rb b/lib/VoucherifySdk/models/parameter_order_list_promotion_tiers.rb new file mode 100644 index 00000000..dc8d2555 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_order_list_promotion_tiers.rb @@ -0,0 +1,42 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterOrderListPromotionTiers + CREATED_AT = "created_at".freeze + CREATED_AT2 = "-created_at".freeze + UPDATED_AT = "updated_at".freeze + UPDATED_AT2 = "-updated_at".freeze + + def self.all_vars + @all_vars ||= [CREATED_AT, CREATED_AT2, UPDATED_AT, UPDATED_AT2].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterOrderListPromotionTiers.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterOrderListPromotionTiers" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_order_list_promotion_tiers_client_side.rb b/lib/VoucherifySdk/models/parameter_order_list_promotion_tiers_client_side.rb new file mode 100644 index 00000000..548b8d73 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_order_list_promotion_tiers_client_side.rb @@ -0,0 +1,42 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterOrderListPromotionTiersClientSide + CREATED_AT = "created_at".freeze + CREATED_AT2 = "-created_at".freeze + UPDATED_AT = "updated_at".freeze + UPDATED_AT2 = "-updated_at".freeze + + def self.all_vars + @all_vars ||= [CREATED_AT, CREATED_AT2, UPDATED_AT, UPDATED_AT2].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterOrderListPromotionTiersClientSide.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterOrderListPromotionTiersClientSide" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_order_list_redeemables.rb b/lib/VoucherifySdk/models/parameter_order_list_redeemables.rb new file mode 100644 index 00000000..6e1b7473 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_order_list_redeemables.rb @@ -0,0 +1,40 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterOrderListRedeemables + ID = "id".freeze + ID2 = "-id".freeze + + def self.all_vars + @all_vars ||= [ID, ID2].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterOrderListRedeemables.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterOrderListRedeemables" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_order_vouchers.rb b/lib/VoucherifySdk/models/parameter_order_vouchers.rb new file mode 100644 index 00000000..27fa2994 --- /dev/null +++ b/lib/VoucherifySdk/models/parameter_order_vouchers.rb @@ -0,0 +1,44 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ParameterOrderVouchers + CREATED_AT = "created_at".freeze + CREATED_AT2 = "-created_at".freeze + UPDATED_AT = "updated_at".freeze + UPDATED_AT2 = "-updated_at".freeze + CODE = "code".freeze + CODE2 = "-code".freeze + + def self.all_vars + @all_vars ||= [CREATED_AT, CREATED_AT2, UPDATED_AT, UPDATED_AT2, CODE, CODE2].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ParameterOrderVouchers.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ParameterOrderVouchers" + end + end +end diff --git a/lib/VoucherifySdk/models/parameter_updated_before_after.rb b/lib/VoucherifySdk/models/parameter_updated_before_after.rb index 9209a1e2..6ad6adaa 100644 --- a/lib/VoucherifySdk/models/parameter_updated_before_after.rb +++ b/lib/VoucherifySdk/models/parameter_updated_before_after.rb @@ -15,10 +15,10 @@ module VoucherifySdk class ParameterUpdatedBeforeAfter - # Timestamp representing the date and time before the voucher was updated in ISO 8601 format. + # Timestamp representing the date and time before the voucher was updated. The value is shown in the ISO 8601 format. attr_accessor :before - # Timestamp representing the date and time after the voucher was updated in ISO 8601 format. + # Timestamp representing the date and time after the voucher was updated. The value is shown in the ISO 8601 format. attr_accessor :after # Attribute mapping from ruby-style variable name to JSON key. @@ -45,21 +45,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'before', + :'after' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ParameterUpdatedBeforeAfter` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ParameterUpdatedBeforeAfter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/product.rb b/lib/VoucherifySdk/models/product.rb index 19406486..78d791e7 100644 --- a/lib/VoucherifySdk/models/product.rb +++ b/lib/VoucherifySdk/models/product.rb @@ -37,13 +37,13 @@ class Product # The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. attr_accessor :image_url - # Timestamp representing the date and time when the product was created in ISO 8601 format. + # Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the product was updated in ISO 8601 format. + # Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the product. + # The type of the object represented by JSON. This object stores information about the product. attr_accessor :object attr_accessor :skus @@ -112,72 +112,51 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', :'name', :'price', + :'attributes', + :'metadata', :'image_url', + :'created_at', :'updated_at', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ProductWithoutSkus' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Product` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Array) self.attributes = value end - else - self.attributes = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'image_url') @@ -208,22 +187,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -231,25 +194,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body.rb b/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body.rb deleted file mode 100644 index efc5c1a5..00000000 --- a/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body.rb +++ /dev/null @@ -1,290 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/product-collections`. - class ProductCollectionsCreateDynamicRequestBody - # Show that the product collection is dynamic (products come in and leave based on set criteria). - attr_accessor :type - - # Unique user-defined product collection name. - attr_accessor :name - - attr_accessor :filter - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'name' => :'name', - :'filter' => :'filter' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'name' => :'String', - :'filter' => :'ProductCollectionsCreateDynamicRequestBodyFilter' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsCreateDynamicRequestBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsCreateDynamicRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'AUTO_UPDATE' - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - else - self.name = nil - end - - if attributes.key?(:'filter') - self.filter = attributes[:'filter'] - else - self.filter = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @filter.nil? - invalid_properties.push('invalid value for "filter", filter cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE"]) - return false unless type_validator.valid?(@type) - return false if @name.nil? - return false if @filter.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - name == o.name && - filter == o.filter - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, name, filter].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body_filter.rb b/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body_filter.rb deleted file mode 100644 index 55690873..00000000 --- a/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body_filter.rb +++ /dev/null @@ -1,352 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. - class ProductCollectionsCreateDynamicRequestBodyFilter - attr_accessor :junction - - attr_accessor :id - - attr_accessor :product_id - - attr_accessor :source_id - - attr_accessor :name - - attr_accessor :price - - attr_accessor :object - - attr_accessor :attributes - - attr_accessor :metadata - - attr_accessor :image_url - - attr_accessor :skus - - attr_accessor :created_at - - attr_accessor :updated_at - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'junction' => :'junction', - :'id' => :'id', - :'product_id' => :'product_id', - :'source_id' => :'source_id', - :'name' => :'name', - :'price' => :'price', - :'object' => :'object', - :'attributes' => :'attributes', - :'metadata' => :'metadata', - :'image_url' => :'image_url', - :'skus' => :'skus', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'junction' => :'Junction', - :'id' => :'FieldConditions', - :'product_id' => :'FieldConditions', - :'source_id' => :'FieldConditions', - :'name' => :'FieldConditions', - :'price' => :'FieldConditions', - :'object' => :'FieldConditions', - :'attributes' => :'FieldConditions', - :'metadata' => :'FieldConditions', - :'image_url' => :'FieldConditions', - :'skus' => :'FieldConditions', - :'created_at' => :'FieldConditions', - :'updated_at' => :'FieldConditions' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyFilter` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'junction') - self.junction = attributes[:'junction'] - else - self.junction = nil - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'product_id') - self.product_id = attributes[:'product_id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'price') - self.price = attributes[:'price'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - end - - if attributes.key?(:'attributes') - self.attributes = attributes[:'attributes'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'image_url') - self.image_url = attributes[:'image_url'] - end - - if attributes.key?(:'skus') - self.skus = attributes[:'skus'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @junction.nil? - invalid_properties.push('invalid value for "junction", junction cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @junction.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - junction == o.junction && - id == o.id && - product_id == o.product_id && - source_id == o.source_id && - name == o.name && - price == o.price && - object == o.object && - attributes == o.attributes && - metadata == o.metadata && - image_url == o.image_url && - skus == o.skus && - created_at == o.created_at && - updated_at == o.updated_at - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [junction, id, product_id, source_id, name, price, object, attributes, metadata, image_url, skus, created_at, updated_at].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body_products_item.rb b/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body_products_item.rb deleted file mode 100644 index 947ac911..00000000 --- a/lib/VoucherifySdk/models/product_collections_create_dynamic_request_body_products_item.rb +++ /dev/null @@ -1,283 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ProductCollectionsCreateDynamicRequestBodyProductsItem - # The product ID. - attr_accessor :id - - # Product ID for SKUs. - attr_accessor :product_id - - # Denotes the type of object represented by the ID. - attr_accessor :object - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'product_id' => :'product_id', - :'object' => :'object' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'product_id' => :'String', - :'object' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyProductsItem` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsCreateDynamicRequestBodyProductsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'product_id') - self.product_id = attributes[:'product_id'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["sku", "product"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku", "product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - product_id == o.product_id && - object == o.object - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, product_id, object].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_create_request_body.rb b/lib/VoucherifySdk/models/product_collections_create_request_body.rb index 0217c394..e5fcd292 100644 --- a/lib/VoucherifySdk/models/product_collections_create_request_body.rb +++ b/lib/VoucherifySdk/models/product_collections_create_request_body.rb @@ -14,93 +14,255 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/product-collections`. - module ProductCollectionsCreateRequestBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ProductCollectionsCreateDynamicRequestBody', - :'ProductCollectionsCreateStaticRequestBody' - ] - end + class ProductCollectionsCreateRequestBody + # Show that the product collection is static (manually selected products). + attr_accessor :type + + # Unique user-defined product collection name. + attr_accessor :name + + # Defines a set of products for a `STATIC` product collection type. + attr_accessor :products + + attr_accessor :filter - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil + def valid?(value) + !value || allowable_values.include?(value) end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'name' => :'name', + :'products' => :'products', + :'filter' => :'filter' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'name' => :'String', + :'products' => :'Array', + :'filter' => :'ProductCollectionsCreateRequestBodyFilter' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'products', + :'filter' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'STATIC' + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["STATIC"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + name == o.name && + products == o.products && + filter == o.filter + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, name, products, filter].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/product_collections_create_request_body_filter.rb b/lib/VoucherifySdk/models/product_collections_create_request_body_filter.rb new file mode 100644 index 00000000..1e4494c4 --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_create_request_body_filter.rb @@ -0,0 +1,345 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + class ProductCollectionsCreateRequestBodyFilter + attr_accessor :junction + + attr_accessor :id + + attr_accessor :product_id + + attr_accessor :source_id + + attr_accessor :name + + attr_accessor :price + + attr_accessor :object + + attr_accessor :attributes + + attr_accessor :metadata + + attr_accessor :image_url + + attr_accessor :skus + + attr_accessor :created_at + + attr_accessor :updated_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'id' => :'id', + :'product_id' => :'product_id', + :'source_id' => :'source_id', + :'name' => :'name', + :'price' => :'price', + :'object' => :'object', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'image_url' => :'image_url', + :'skus' => :'skus', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'id' => :'FieldConditions', + :'product_id' => :'FieldConditions', + :'source_id' => :'FieldConditions', + :'name' => :'FieldConditions', + :'price' => :'FieldConditions', + :'object' => :'FieldConditions', + :'attributes' => :'FieldConditions', + :'metadata' => :'FieldConditions', + :'image_url' => :'FieldConditions', + :'skus' => :'FieldConditions', + :'created_at' => :'FieldConditions', + :'updated_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + else + self.junction = nil + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'skus') + self.skus = attributes[:'skus'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @junction.nil? + invalid_properties.push('invalid value for "junction", junction cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @junction.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + id == o.id && + product_id == o.product_id && + source_id == o.source_id && + name == o.name && + price == o.price && + object == o.object && + attributes == o.attributes && + metadata == o.metadata && + image_url == o.image_url && + skus == o.skus && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, id, product_id, source_id, name, price, object, attributes, metadata, image_url, skus, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_create_request_body_products_item.rb b/lib/VoucherifySdk/models/product_collections_create_request_body_products_item.rb new file mode 100644 index 00000000..11bcd08e --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_create_request_body_products_item.rb @@ -0,0 +1,266 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ProductCollectionsCreateRequestBodyProductsItem + # The product ID. + attr_accessor :id + + # Product ID for SKUs. + attr_accessor :product_id + + # Denotes the type of the object represented by the ID. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'product_id' => :'product_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'product_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @object.nil? + object_validator = EnumAttributeValidator.new('String', ["sku", "product"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + product_id == o.product_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, product_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_create_response_body.rb b/lib/VoucherifySdk/models/product_collections_create_response_body.rb index 6776319d..271e5e2f 100644 --- a/lib/VoucherifySdk/models/product_collections_create_response_body.rb +++ b/lib/VoucherifySdk/models/product_collections_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/product-collections`. + # Response body schema for **POST** `v1/product-collections`. class ProductCollectionsCreateResponseBody # Product collection ID. attr_accessor :id @@ -30,10 +30,10 @@ class ProductCollectionsCreateResponseBody # Defines a set of products for a `STATIC` product collection type. attr_accessor :products - # Timestamp representing the date and time when the product collection was created in ISO 8601 format. + # Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # The type of object represented by JSON. This object stores information about the static product collection. + # The type of the object represented by JSON. This object stores information about the static product collection. attr_accessor :object class EnumAttributeValidator @@ -82,8 +82,8 @@ def self.openapi_types :'id' => :'String', :'name' => :'String', :'type' => :'String', - :'filter' => :'ProductCollectionsCreateDynamicRequestBodyFilter', - :'products' => :'Array', + :'filter' => :'ProductCollectionsCreateResponseBodyFilter', + :'products' => :'Array', :'created_at' => :'Time', :'object' => :'String' } @@ -92,47 +92,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'type', + :'filter', + :'products', + :'created_at', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ProductCollectionsItem' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'filter') @@ -147,8 +134,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'object') @@ -163,26 +148,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -190,38 +155,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) return false unless type_validator.valid?(@type) - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["products_collection"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["products_collection"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/product_collections_create_response_body_filter.rb b/lib/VoucherifySdk/models/product_collections_create_response_body_filter.rb new file mode 100644 index 00000000..b262001b --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_create_response_body_filter.rb @@ -0,0 +1,345 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + class ProductCollectionsCreateResponseBodyFilter + attr_accessor :junction + + attr_accessor :id + + attr_accessor :product_id + + attr_accessor :source_id + + attr_accessor :name + + attr_accessor :price + + attr_accessor :object + + attr_accessor :attributes + + attr_accessor :metadata + + attr_accessor :image_url + + attr_accessor :skus + + attr_accessor :created_at + + attr_accessor :updated_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'id' => :'id', + :'product_id' => :'product_id', + :'source_id' => :'source_id', + :'name' => :'name', + :'price' => :'price', + :'object' => :'object', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'image_url' => :'image_url', + :'skus' => :'skus', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'id' => :'FieldConditions', + :'product_id' => :'FieldConditions', + :'source_id' => :'FieldConditions', + :'name' => :'FieldConditions', + :'price' => :'FieldConditions', + :'object' => :'FieldConditions', + :'attributes' => :'FieldConditions', + :'metadata' => :'FieldConditions', + :'image_url' => :'FieldConditions', + :'skus' => :'FieldConditions', + :'created_at' => :'FieldConditions', + :'updated_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + else + self.junction = nil + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'skus') + self.skus = attributes[:'skus'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @junction.nil? + invalid_properties.push('invalid value for "junction", junction cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @junction.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + id == o.id && + product_id == o.product_id && + source_id == o.source_id && + name == o.name && + price == o.price && + object == o.object && + attributes == o.attributes && + metadata == o.metadata && + image_url == o.image_url && + skus == o.skus && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, id, product_id, source_id, name, price, object, attributes, metadata, image_url, skus, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_create_response_body_products_item.rb b/lib/VoucherifySdk/models/product_collections_create_response_body_products_item.rb new file mode 100644 index 00000000..916a5808 --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_create_response_body_products_item.rb @@ -0,0 +1,266 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ProductCollectionsCreateResponseBodyProductsItem + # The product ID. + attr_accessor :id + + # Product ID for SKUs. + attr_accessor :product_id + + # Denotes the type of the object represented by the ID. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'product_id' => :'product_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'product_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @object.nil? + object_validator = EnumAttributeValidator.new('String', ["sku", "product"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + product_id == o.product_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, product_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_create_static_request_body.rb b/lib/VoucherifySdk/models/product_collections_create_static_request_body.rb deleted file mode 100644 index 853e8b49..00000000 --- a/lib/VoucherifySdk/models/product_collections_create_static_request_body.rb +++ /dev/null @@ -1,286 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/product-collections`. - class ProductCollectionsCreateStaticRequestBody - # Show that the product collection is static (manually selected products). - attr_accessor :type - - # Unique user-defined product collection name. - attr_accessor :name - - # Defines a set of products for a `STATIC` product collection type. - attr_accessor :products - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'name' => :'name', - :'products' => :'products' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'name' => :'String', - :'products' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsCreateStaticRequestBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsCreateStaticRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'STATIC' - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - else - self.name = nil - end - - if attributes.key?(:'products') - if (value = attributes[:'products']).is_a?(Array) - self.products = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) - return false unless type_validator.valid?(@type) - return false if @name.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - name == o.name && - products == o.products - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, name, products].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_get_response_body.rb b/lib/VoucherifySdk/models/product_collections_get_response_body.rb index c48f55a3..730c0f0b 100644 --- a/lib/VoucherifySdk/models/product_collections_get_response_body.rb +++ b/lib/VoucherifySdk/models/product_collections_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/product-collections/{productCollectionId}`. + # Response body schema for **GET** `v1/product-collections/{productCollectionId}`. class ProductCollectionsGetResponseBody # Product collection ID. attr_accessor :id @@ -30,10 +30,10 @@ class ProductCollectionsGetResponseBody # Defines a set of products for a `STATIC` product collection type. attr_accessor :products - # Timestamp representing the date and time when the product collection was created in ISO 8601 format. + # Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # The type of object represented by JSON. This object stores information about the static product collection. + # The type of the object represented by JSON. This object stores information about the static product collection. attr_accessor :object class EnumAttributeValidator @@ -82,8 +82,8 @@ def self.openapi_types :'id' => :'String', :'name' => :'String', :'type' => :'String', - :'filter' => :'ProductCollectionsCreateDynamicRequestBodyFilter', - :'products' => :'Array', + :'filter' => :'ProductCollectionsGetResponseBodyFilter', + :'products' => :'Array', :'created_at' => :'Time', :'object' => :'String' } @@ -92,47 +92,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'type', + :'filter', + :'products', + :'created_at', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ProductCollectionsItem' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'filter') @@ -147,8 +134,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'object') @@ -163,26 +148,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -190,38 +155,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) return false unless type_validator.valid?(@type) - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["products_collection"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["products_collection"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/product_collections_get_response_body_filter.rb b/lib/VoucherifySdk/models/product_collections_get_response_body_filter.rb new file mode 100644 index 00000000..71200685 --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_get_response_body_filter.rb @@ -0,0 +1,345 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + class ProductCollectionsGetResponseBodyFilter + attr_accessor :junction + + attr_accessor :id + + attr_accessor :product_id + + attr_accessor :source_id + + attr_accessor :name + + attr_accessor :price + + attr_accessor :object + + attr_accessor :attributes + + attr_accessor :metadata + + attr_accessor :image_url + + attr_accessor :skus + + attr_accessor :created_at + + attr_accessor :updated_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'id' => :'id', + :'product_id' => :'product_id', + :'source_id' => :'source_id', + :'name' => :'name', + :'price' => :'price', + :'object' => :'object', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'image_url' => :'image_url', + :'skus' => :'skus', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'id' => :'FieldConditions', + :'product_id' => :'FieldConditions', + :'source_id' => :'FieldConditions', + :'name' => :'FieldConditions', + :'price' => :'FieldConditions', + :'object' => :'FieldConditions', + :'attributes' => :'FieldConditions', + :'metadata' => :'FieldConditions', + :'image_url' => :'FieldConditions', + :'skus' => :'FieldConditions', + :'created_at' => :'FieldConditions', + :'updated_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + else + self.junction = nil + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'skus') + self.skus = attributes[:'skus'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @junction.nil? + invalid_properties.push('invalid value for "junction", junction cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @junction.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + id == o.id && + product_id == o.product_id && + source_id == o.source_id && + name == o.name && + price == o.price && + object == o.object && + attributes == o.attributes && + metadata == o.metadata && + image_url == o.image_url && + skus == o.skus && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, id, product_id, source_id, name, price, object, attributes, metadata, image_url, skus, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_get_response_body_products_item.rb b/lib/VoucherifySdk/models/product_collections_get_response_body_products_item.rb new file mode 100644 index 00000000..30dfba1c --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_get_response_body_products_item.rb @@ -0,0 +1,266 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ProductCollectionsGetResponseBodyProductsItem + # The product ID. + attr_accessor :id + + # Product ID for SKUs. + attr_accessor :product_id + + # Denotes the type of the object represented by the ID. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'product_id' => :'product_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'product_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @object.nil? + object_validator = EnumAttributeValidator.new('String', ["sku", "product"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + product_id == o.product_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, product_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_item.rb b/lib/VoucherifySdk/models/product_collections_item.rb index 357541e8..8dced849 100644 --- a/lib/VoucherifySdk/models/product_collections_item.rb +++ b/lib/VoucherifySdk/models/product_collections_item.rb @@ -30,10 +30,10 @@ class ProductCollectionsItem # Defines a set of products for a `STATIC` product collection type. attr_accessor :products - # Timestamp representing the date and time when the product collection was created in ISO 8601 format. + # Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # The type of object represented by JSON. This object stores information about the static product collection. + # The type of the object represented by JSON. This object stores information about the static product collection. attr_accessor :object class EnumAttributeValidator @@ -82,7 +82,7 @@ def self.openapi_types :'id' => :'String', :'name' => :'String', :'type' => :'String', - :'filter' => :'ProductCollectionsCreateDynamicRequestBodyFilter', + :'filter' => :'ProductCollectionsItemFilter', :'products' => :'Array', :'created_at' => :'Time', :'object' => :'String' @@ -92,40 +92,34 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'type', + :'filter', + :'products', + :'created_at', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'filter') @@ -140,8 +134,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'object') @@ -156,26 +148,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -183,38 +155,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) return false unless type_validator.valid?(@type) - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["products_collection"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["STATIC", "AUTO_UPDATE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["products_collection"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/product_collections_item_filter.rb b/lib/VoucherifySdk/models/product_collections_item_filter.rb new file mode 100644 index 00000000..d36023c1 --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_item_filter.rb @@ -0,0 +1,345 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + class ProductCollectionsItemFilter + attr_accessor :junction + + attr_accessor :id + + attr_accessor :product_id + + attr_accessor :source_id + + attr_accessor :name + + attr_accessor :price + + attr_accessor :object + + attr_accessor :attributes + + attr_accessor :metadata + + attr_accessor :image_url + + attr_accessor :skus + + attr_accessor :created_at + + attr_accessor :updated_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'junction' => :'junction', + :'id' => :'id', + :'product_id' => :'product_id', + :'source_id' => :'source_id', + :'name' => :'name', + :'price' => :'price', + :'object' => :'object', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'image_url' => :'image_url', + :'skus' => :'skus', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'junction' => :'Junction', + :'id' => :'FieldConditions', + :'product_id' => :'FieldConditions', + :'source_id' => :'FieldConditions', + :'name' => :'FieldConditions', + :'price' => :'FieldConditions', + :'object' => :'FieldConditions', + :'attributes' => :'FieldConditions', + :'metadata' => :'FieldConditions', + :'image_url' => :'FieldConditions', + :'skus' => :'FieldConditions', + :'created_at' => :'FieldConditions', + :'updated_at' => :'FieldConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'junction') + self.junction = attributes[:'junction'] + else + self.junction = nil + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'skus') + self.skus = attributes[:'skus'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @junction.nil? + invalid_properties.push('invalid value for "junction", junction cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @junction.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + junction == o.junction && + id == o.id && + product_id == o.product_id && + source_id == o.source_id && + name == o.name && + price == o.price && + object == o.object && + attributes == o.attributes && + metadata == o.metadata && + image_url == o.image_url && + skus == o.skus && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [junction, id, product_id, source_id, name, price, object, attributes, metadata, image_url, skus, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_collections_item_products_item.rb b/lib/VoucherifySdk/models/product_collections_item_products_item.rb index 817a7f98..64d310fd 100644 --- a/lib/VoucherifySdk/models/product_collections_item_products_item.rb +++ b/lib/VoucherifySdk/models/product_collections_item_products_item.rb @@ -21,7 +21,7 @@ class ProductCollectionsItemProductsItem # Product ID for SKUs. attr_accessor :product_id - # Denotes the type of object represented by the ID. + # Denotes the type of the object represented by the ID. attr_accessor :object class EnumAttributeValidator @@ -78,15 +78,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsItemProductsItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsItemProductsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -134,16 +127,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku", "product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/product_collections_list.rb b/lib/VoucherifySdk/models/product_collections_list.rb deleted file mode 100644 index 15416b89..00000000 --- a/lib/VoucherifySdk/models/product_collections_list.rb +++ /dev/null @@ -1,322 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Schema representing list of product collections - class ProductCollectionsList - # The type of object represented by JSON. This object stores information about product collections. - attr_accessor :object - - # Identifies the name of the JSON property that contains the array of product collections. - attr_accessor :data_ref - - # A dictionary that contains an array of product collections and their details. - attr_accessor :data - - # Total number of product collections. - attr_accessor :total - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'data_ref' => :'data_ref', - :'data' => :'data', - :'total' => :'total' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'data_ref' => :'String', - :'data' => :'Array', - :'total' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsList` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'list' - end - - if attributes.key?(:'data_ref') - self.data_ref = attributes[:'data_ref'] - else - self.data_ref = 'data' - end - - if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end - else - self.data = nil - end - - if attributes.key?(:'total') - self.total = attributes[:'total'] - else - self.total = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["list"]) - return false unless object_validator.valid?(@object) - return false if @data_ref.nil? - data_ref_validator = EnumAttributeValidator.new('String', ["data"]) - return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - data_ref == o.data_ref && - data == o.data && - total == o.total - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, data_ref, data, total].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_list_response_body.rb b/lib/VoucherifySdk/models/product_collections_list_response_body.rb index c5b46a62..14acc2d4 100644 --- a/lib/VoucherifySdk/models/product_collections_list_response_body.rb +++ b/lib/VoucherifySdk/models/product_collections_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/product-collections`. + # Response body schema for **GET** `v1/product-collections`. class ProductCollectionsListResponseBody - # The type of object represented by JSON. This object stores information about product collections. + # The type of the object represented by JSON. This object stores information about product collections. attr_accessor :object # Identifies the name of the JSON property that contains the array of product collections. @@ -78,28 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ProductCollectionsList' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -119,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -135,22 +121,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -158,37 +128,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/product_collections_products_list.rb b/lib/VoucherifySdk/models/product_collections_products_list.rb deleted file mode 100644 index cb58759e..00000000 --- a/lib/VoucherifySdk/models/product_collections_products_list.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **GET** /product-collections/{productCollectionID}/products. - class ProductCollectionsProductsList - # The type of object represented by JSON. This object stores information about products and SKUs. - attr_accessor :object - - # Identifies the name of the JSON property that contains the array of products and SKUs. - attr_accessor :data_ref - - # A dictionary that contains an array of products and SKUs. - attr_accessor :data - - # Total number of products & SKUs in the product collection. - attr_accessor :total - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'data_ref' => :'data_ref', - :'data' => :'data', - :'total' => :'total' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'data_ref' => :'String', - :'data' => :'Array', - :'total' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsProductsList` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsProductsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'list' - end - - if attributes.key?(:'data_ref') - self.data_ref = attributes[:'data_ref'] - else - self.data_ref = 'data' - end - - if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end - else - self.data = nil - end - - if attributes.key?(:'total') - self.total = attributes[:'total'] - else - self.total = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - data_ref == o.data_ref && - data == o.data && - total == o.total - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, data_ref, data, total].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_products_list_products_item.rb b/lib/VoucherifySdk/models/product_collections_products_list_products_item.rb deleted file mode 100644 index c47f3775..00000000 --- a/lib/VoucherifySdk/models/product_collections_products_list_products_item.rb +++ /dev/null @@ -1,105 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module ProductCollectionsProductsListProductsItem - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ProductWithoutSkus', - :'SkuWithProduct' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/product_collections_products_list_response_body.rb b/lib/VoucherifySdk/models/product_collections_products_list_response_body.rb index 260adba2..b00ae1d5 100644 --- a/lib/VoucherifySdk/models/product_collections_products_list_response_body.rb +++ b/lib/VoucherifySdk/models/product_collections_products_list_response_body.rb @@ -14,15 +14,14 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/product-collections/{productCollectionId}/products`. + # Response body schema for **GET** `v1/product-collections/{productCollectionId}/products`. class ProductCollectionsProductsListResponseBody - # The type of object represented by JSON. This object stores information about products and SKUs. + # The type of the object represented by JSON. This object stores information about products and SKUs. attr_accessor :object # Identifies the name of the JSON property that contains the array of products and SKUs. attr_accessor :data_ref - # A dictionary that contains an array of products and SKUs. attr_accessor :data # Total number of products & SKUs in the product collection. @@ -48,7 +47,7 @@ def self.openapi_types { :'object' => :'String', :'data_ref' => :'String', - :'data' => :'Array', + :'data' => :'Array', :'total' => :'Integer' } end @@ -56,28 +55,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ProductCollectionsProductsList' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductCollectionsProductsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductCollectionsProductsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -97,14 +86,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -113,22 +98,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -136,10 +105,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/product_collections_products_list_response_body_data_item.rb b/lib/VoucherifySdk/models/product_collections_products_list_response_body_data_item.rb new file mode 100644 index 00000000..b343f07f --- /dev/null +++ b/lib/VoucherifySdk/models/product_collections_products_list_response_body_data_item.rb @@ -0,0 +1,362 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ProductCollectionsProductsListResponseBodyDataItem + attr_accessor :id + + attr_accessor :source_id + + # Unique user-defined product name. + attr_accessor :name + + # Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + attr_accessor :price + + # A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + attr_accessor :attributes + + attr_accessor :metadata + + attr_accessor :image_url + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :object + + # The parent product's unique ID. + attr_accessor :product_id + + # Unique user-defined SKU name. + attr_accessor :sku + + # SKU price currency. + attr_accessor :currency + + attr_accessor :product + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'name' => :'name', + :'price' => :'price', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'image_url' => :'image_url', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'object' => :'object', + :'product_id' => :'product_id', + :'sku' => :'sku', + :'currency' => :'currency', + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'name' => :'String', + :'price' => :'Integer', + :'attributes' => :'Array', + :'metadata' => :'Object', + :'image_url' => :'String', + :'created_at' => :'String', + :'updated_at' => :'String', + :'object' => :'String', + :'product_id' => :'String', + :'sku' => :'String', + :'currency' => :'String', + :'product' => :'ProductWithoutSkus' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'price', + :'attributes', + :'product_id', + :'sku', + :'currency', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'attributes') + if (value = attributes[:'attributes']).is_a?(Array) + self.attributes = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["product", "sku"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + name == o.name && + price == o.price && + attributes == o.attributes && + metadata == o.metadata && + image_url == o.image_url && + created_at == o.created_at && + updated_at == o.updated_at && + object == o.object && + product_id == o.product_id && + sku == o.sku && + currency == o.currency && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, name, price, attributes, metadata, image_url, created_at, updated_at, object, product_id, sku, currency, product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/product_without_skus.rb b/lib/VoucherifySdk/models/product_without_skus.rb index 98aff177..3059ed0c 100644 --- a/lib/VoucherifySdk/models/product_without_skus.rb +++ b/lib/VoucherifySdk/models/product_without_skus.rb @@ -36,13 +36,13 @@ class ProductWithoutSkus # The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. attr_accessor :image_url - # Timestamp representing the date and time when the product was created in ISO 8601 format. + # Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the product was updated in ISO 8601 format. + # Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the product. + # The type of the object represented by JSON. This object stores information about the product. attr_accessor :object class EnumAttributeValidator @@ -107,65 +107,51 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', :'name', :'price', + :'attributes', + :'metadata', :'image_url', + :'created_at', :'updated_at', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductWithoutSkus` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductWithoutSkus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Array) self.attributes = value end - else - self.attributes = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'image_url') @@ -192,22 +178,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -215,25 +185,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/products_create_request_body.rb b/lib/VoucherifySdk/models/products_create_request_body.rb index ecfc8c14..69227e54 100644 --- a/lib/VoucherifySdk/models/products_create_request_body.rb +++ b/lib/VoucherifySdk/models/products_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request schema for **POST** `/products`. + # Request schema for **POST** `v1/products`. class ProductsCreateRequestBody # A unique identifier that represents the product and is assigned by Voucherify. attr_accessor :id @@ -71,21 +71,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name', + :'price', + :'attributes', + :'metadata', + :'image_url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/products_create_response_body.rb b/lib/VoucherifySdk/models/products_create_response_body.rb index 35778c02..7cda7e7d 100644 --- a/lib/VoucherifySdk/models/products_create_response_body.rb +++ b/lib/VoucherifySdk/models/products_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/products`. + # Response body schema for **POST** `v1/products`. class ProductsCreateResponseBody # Unique product ID assigned by Voucherify. attr_accessor :id @@ -37,13 +37,13 @@ class ProductsCreateResponseBody # The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. attr_accessor :image_url - # Timestamp representing the date and time when the product was created in ISO 8601 format. + # Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the product was updated in ISO 8601 format. + # Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the product. + # The type of the object represented by JSON. This object stores information about the product. attr_accessor :object attr_accessor :skus @@ -112,72 +112,51 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', :'name', :'price', + :'attributes', + :'metadata', :'image_url', + :'created_at', :'updated_at', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Product' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Array) self.attributes = value end - else - self.attributes = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'image_url') @@ -208,22 +187,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -231,25 +194,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/products_get_response_body.rb b/lib/VoucherifySdk/models/products_get_response_body.rb index c00dce63..57f3f056 100644 --- a/lib/VoucherifySdk/models/products_get_response_body.rb +++ b/lib/VoucherifySdk/models/products_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/products/{productId}`. + # Response body schema for **GET** `v1/products/{productId}`. class ProductsGetResponseBody # Unique product ID assigned by Voucherify. attr_accessor :id @@ -37,13 +37,13 @@ class ProductsGetResponseBody # The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. attr_accessor :image_url - # Timestamp representing the date and time when the product was created in ISO 8601 format. + # Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the product was updated in ISO 8601 format. + # Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the product. + # The type of the object represented by JSON. This object stores information about the product. attr_accessor :object attr_accessor :skus @@ -112,72 +112,51 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', :'name', :'price', + :'attributes', + :'metadata', :'image_url', + :'created_at', :'updated_at', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Product' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Array) self.attributes = value end - else - self.attributes = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'image_url') @@ -208,22 +187,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -231,25 +194,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/products_import_csv_create_response_body.rb b/lib/VoucherifySdk/models/products_import_csv_create_response_body.rb index 26068f70..3101f45d 100644 --- a/lib/VoucherifySdk/models/products_import_csv_create_response_body.rb +++ b/lib/VoucherifySdk/models/products_import_csv_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/products/importCSV`. + # Response body schema for **POST** `v1/products/importCSV`. class ProductsImportCsvCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsImportCsvCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsImportCsvCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/products_list_response_body.rb b/lib/VoucherifySdk/models/products_list_response_body.rb index a1320cdc..87f3c29a 100644 --- a/lib/VoucherifySdk/models/products_list_response_body.rb +++ b/lib/VoucherifySdk/models/products_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/products`. + # Response body schema for **GET** `v1/products`. class ProductsListResponseBody - # The type of object represented by JSON. This object stores information about products in a dictionary. + # The type of the object represented by JSON. This object stores information about products in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of product objects. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'products', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'products']).is_a?(Array) self.products = value end - else - self.products = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @products.nil? - invalid_properties.push('invalid value for "products", products cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @products.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/products_metadata_update_in_bulk_request_body.rb b/lib/VoucherifySdk/models/products_metadata_update_in_bulk_request_body.rb index 44ca54ec..f000a61a 100644 --- a/lib/VoucherifySdk/models/products_metadata_update_in_bulk_request_body.rb +++ b/lib/VoucherifySdk/models/products_metadata_update_in_bulk_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request schema for **POST** `/products/metadata/async`. + # Request schema for **POST** `v1/products/metadata/async`. class ProductsMetadataUpdateInBulkRequestBody # Array of unique product source IDs. attr_accessor :source_ids @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'source_ids', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsMetadataUpdateInBulkRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsMetadataUpdateInBulkRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -68,14 +63,10 @@ def initialize(attributes = {}) if (value = attributes[:'source_ids']).is_a?(Array) self.source_ids = value end - else - self.source_ids = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end end @@ -84,14 +75,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @source_ids.nil? - invalid_properties.push('invalid value for "source_ids", source_ids cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - invalid_properties end @@ -99,8 +82,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @source_ids.nil? - return false if @metadata.nil? true end diff --git a/lib/VoucherifySdk/models/products_metadata_update_in_bulk_response_body.rb b/lib/VoucherifySdk/models/products_metadata_update_in_bulk_response_body.rb index 89060bf3..670de2e8 100644 --- a/lib/VoucherifySdk/models/products_metadata_update_in_bulk_response_body.rb +++ b/lib/VoucherifySdk/models/products_metadata_update_in_bulk_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/products/metadata/async`. + # Response body schema for **POST** `v1/products/metadata/async`. class ProductsMetadataUpdateInBulkResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsMetadataUpdateInBulkResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsMetadataUpdateInBulkResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/products_skus_create_request_body.rb b/lib/VoucherifySdk/models/products_skus_create_request_body.rb index 69341c2a..0e7dd0d0 100644 --- a/lib/VoucherifySdk/models/products_skus_create_request_body.rb +++ b/lib/VoucherifySdk/models/products_skus_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/products/{productId}/skus + # Request body schema for **POST** `v1/products/{productId}/skus class ProductsSkusCreateRequestBody # Unique SKU ID. attr_accessor :id @@ -76,21 +76,22 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'sku', + :'price', + :'currency', + :'attributes', + :'image_url', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsSkusCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsSkusCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/products_skus_create_response_body.rb b/lib/VoucherifySdk/models/products_skus_create_response_body.rb index 7aa03f72..f8bf6069 100644 --- a/lib/VoucherifySdk/models/products_skus_create_response_body.rb +++ b/lib/VoucherifySdk/models/products_skus_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/products/{productId}/skus`. + # Response body schema for **PUT** `v1/products/{productId}/skus`. class ProductsSkusCreateResponseBody # A unique identifier that represents the SKU and is assigned by Voucherify. attr_accessor :id @@ -43,13 +43,13 @@ class ProductsSkusCreateResponseBody # The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the SKU was created in ISO 8601 format. + # Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the SKU was updated in ISO 8601 format. + # Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the `SKU`. + # The type of the object represented by JSON. This object stores information about the `SKU`. attr_accessor :object class EnumAttributeValidator @@ -118,65 +118,47 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'product_id', :'sku', :'price', :'currency', + :'attributes', :'image_url', + :'metadata', + :'created_at', :'updated_at', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Sku' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsSkusCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsSkusCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] - else - self.product_id = nil end if attributes.key?(:'sku') self.sku = attributes[:'sku'] - else - self.sku = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'currency') @@ -185,32 +167,22 @@ def initialize(attributes = {}) if attributes.key?(:'attributes') self.attributes = attributes[:'attributes'] - else - self.attributes = nil end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] - else - self.image_url = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -225,30 +197,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @product_id.nil? - invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -256,27 +204,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @product_id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["sku"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/products_skus_list_response_body.rb b/lib/VoucherifySdk/models/products_skus_list_response_body.rb index 258cd226..f54104ec 100644 --- a/lib/VoucherifySdk/models/products_skus_list_response_body.rb +++ b/lib/VoucherifySdk/models/products_skus_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/products/{productId}/skus`. + # Response body schema for **GET** `v1/products/{productId}/skus`. class ProductsSkusListResponseBody - # The type of object represented by JSON. This object stores information about SKUs. + # The type of the object represented by JSON. This object stores information about SKUs. attr_accessor :object # Identifies the name of the JSON property that contains the array of SKUs. @@ -56,28 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'skus', + :'total' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'SkusList' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsSkusListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsSkusListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -97,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'skus']).is_a?(Array) self.skus = value end - else - self.skus = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -113,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @skus.nil? - invalid_properties.push('invalid value for "skus", skus cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -136,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @skus.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/products_skus_update_request_body.rb b/lib/VoucherifySdk/models/products_skus_update_request_body.rb index b1276499..0a69a139 100644 --- a/lib/VoucherifySdk/models/products_skus_update_request_body.rb +++ b/lib/VoucherifySdk/models/products_skus_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **PUT** `/products/{productId}/skus/{skuId}`. + # Request body schema for **PUT** `v1/products/{productId}/skus/{skuId}`. class ProductsSkusUpdateRequestBody # Unique user-defined SKU name. attr_accessor :sku @@ -66,21 +66,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'sku', + :'price', + :'currency', + :'attributes', + :'image_url', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsSkusUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsSkusUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/products_skus_update_response_body.rb b/lib/VoucherifySdk/models/products_skus_update_response_body.rb index 8734b9a7..897ed351 100644 --- a/lib/VoucherifySdk/models/products_skus_update_response_body.rb +++ b/lib/VoucherifySdk/models/products_skus_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/products/{productId}/skus/{skuId}`. + # Response body schema for **PUT** `v1/products/{productId}/skus/{skuId}`. class ProductsSkusUpdateResponseBody # A unique identifier that represents the SKU and is assigned by Voucherify. attr_accessor :id @@ -43,13 +43,13 @@ class ProductsSkusUpdateResponseBody # The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the SKU was created in ISO 8601 format. + # Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the SKU was updated in ISO 8601 format. + # Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the `SKU`. + # The type of the object represented by JSON. This object stores information about the `SKU`. attr_accessor :object class EnumAttributeValidator @@ -118,65 +118,47 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'product_id', :'sku', :'price', :'currency', + :'attributes', :'image_url', + :'metadata', + :'created_at', :'updated_at', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Sku' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsSkusUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsSkusUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] - else - self.product_id = nil end if attributes.key?(:'sku') self.sku = attributes[:'sku'] - else - self.sku = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'currency') @@ -185,32 +167,22 @@ def initialize(attributes = {}) if attributes.key?(:'attributes') self.attributes = attributes[:'attributes'] - else - self.attributes = nil end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] - else - self.image_url = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -225,30 +197,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @product_id.nil? - invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -256,27 +204,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @product_id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["sku"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/products_update_in_bulk_request_body.rb b/lib/VoucherifySdk/models/products_update_in_bulk_request_body.rb index b487d463..201caf36 100644 --- a/lib/VoucherifySdk/models/products_update_in_bulk_request_body.rb +++ b/lib/VoucherifySdk/models/products_update_in_bulk_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request schema for **POST** `/products/bulk/async`. + # Request schema for **POST** `v1/products/bulk/async`. class ProductsUpdateInBulkRequestBody # Unique product source ID from your inventory system. attr_accessor :source_id @@ -66,28 +66,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'source_id', + :'name', + :'price', + :'attributes', + :'image_url', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsUpdateInBulkRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsUpdateInBulkRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'name') @@ -118,10 +115,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @source_id.nil? - invalid_properties.push('invalid value for "source_id", source_id cannot be nil.') - end - invalid_properties end @@ -129,7 +122,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @source_id.nil? true end diff --git a/lib/VoucherifySdk/models/products_update_in_bulk_response_body.rb b/lib/VoucherifySdk/models/products_update_in_bulk_response_body.rb index 97aefe6b..770d1f3f 100644 --- a/lib/VoucherifySdk/models/products_update_in_bulk_response_body.rb +++ b/lib/VoucherifySdk/models/products_update_in_bulk_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/products/bulk/async`. + # Response body schema for **POST** `v1/products/bulk/async`. class ProductsUpdateInBulkResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsUpdateInBulkResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsUpdateInBulkResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/products_update_request_body.rb b/lib/VoucherifySdk/models/products_update_request_body.rb index 8f693254..f763ab54 100644 --- a/lib/VoucherifySdk/models/products_update_request_body.rb +++ b/lib/VoucherifySdk/models/products_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request schema for **PUT** `/products`. + # Request schema for **PUT** `v1/products`. class ProductsUpdateRequestBody # Unique user-defined product name. attr_accessor :name @@ -61,21 +61,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'price', + :'attributes', + :'metadata', + :'image_url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/products_update_response_body.rb b/lib/VoucherifySdk/models/products_update_response_body.rb index 74222e9f..9ae2a712 100644 --- a/lib/VoucherifySdk/models/products_update_response_body.rb +++ b/lib/VoucherifySdk/models/products_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/products/{productId}`. + # Response body schema for **PUT** `v1/products/{productId}`. class ProductsUpdateResponseBody # Unique product ID assigned by Voucherify. attr_accessor :id @@ -37,13 +37,13 @@ class ProductsUpdateResponseBody # The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. attr_accessor :image_url - # Timestamp representing the date and time when the product was created in ISO 8601 format. + # Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the product was updated in ISO 8601 format. + # Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the product. + # The type of the object represented by JSON. This object stores information about the product. attr_accessor :object attr_accessor :skus @@ -112,72 +112,51 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', :'name', :'price', + :'attributes', + :'metadata', :'image_url', + :'created_at', :'updated_at', + :'object', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Product' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ProductsUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ProductsUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Array) self.attributes = value end - else - self.attributes = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'image_url') @@ -208,22 +187,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -231,25 +194,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["product"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotion_stack.rb b/lib/VoucherifySdk/models/promotion_stack.rb index efb6d0b7..d8aa80f3 100644 --- a/lib/VoucherifySdk/models/promotion_stack.rb +++ b/lib/VoucherifySdk/models/promotion_stack.rb @@ -23,16 +23,16 @@ class PromotionStack # Unique promotion stack ID. attr_accessor :id - # Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Promotion stack's parent campaign's unique ID. attr_accessor :campaign_id - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Promotion stack category ID. @@ -87,7 +87,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'tiers' => :'PromotionStackBaseTiers', + :'tiers' => :'PromotionStackTiers', :'id' => :'String', :'created_at' => :'Time', :'updated_at' => :'Time', @@ -101,54 +101,40 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers', + :'id', + :'created_at', + :'updated_at', + :'campaign_id', + :'object', :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionStackBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionStack` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionStack`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'tiers') self.tiers = attributes[:'tiers'] - else - self.tiers = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -157,8 +143,6 @@ def initialize(attributes = {}) if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'object') @@ -169,16 +153,12 @@ def initialize(attributes = {}) if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end end @@ -187,34 +167,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @tiers.nil? - invalid_properties.push('invalid value for "tiers", tiers cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - invalid_properties end @@ -222,28 +174,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @tiers.nil? - return false if @id.nil? - return false if @created_at.nil? - return false if @campaign_id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["promotion_stack"]) return false unless object_validator.valid?(@object) - return false if @categories.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["promotion_stack"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotion_stack_base.rb b/lib/VoucherifySdk/models/promotion_stack_base.rb index ed3c1c15..8cb60ef1 100644 --- a/lib/VoucherifySdk/models/promotion_stack_base.rb +++ b/lib/VoucherifySdk/models/promotion_stack_base.rb @@ -44,34 +44,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionStackBase` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionStackBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'tiers') self.tiers = attributes[:'tiers'] - else - self.tiers = nil end end @@ -80,14 +71,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @tiers.nil? - invalid_properties.push('invalid value for "tiers", tiers cannot be nil.') - end - invalid_properties end @@ -95,8 +78,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @tiers.nil? true end diff --git a/lib/VoucherifySdk/models/promotion_stack_base_tiers.rb b/lib/VoucherifySdk/models/promotion_stack_base_tiers.rb index 300dd287..917d2599 100644 --- a/lib/VoucherifySdk/models/promotion_stack_base_tiers.rb +++ b/lib/VoucherifySdk/models/promotion_stack_base_tiers.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Contains the tier configuration. + # Contains the tier configuration. A promotion stack can include up to 30 tiers. class PromotionStackBaseTiers # Contains the list of tiers in a pre-defined sequence. attr_accessor :ids @@ -67,21 +67,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'ids', + :'hierarchy_mode' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionStackBaseTiers` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionStackBaseTiers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -89,8 +84,6 @@ def initialize(attributes = {}) if (value = attributes[:'ids']).is_a?(Array) self.ids = value end - else - self.ids = nil end if attributes.key?(:'hierarchy_mode') @@ -105,11 +98,7 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @ids.nil? - invalid_properties.push('invalid value for "ids", ids cannot be nil.') - end - - if @ids.length < 1 + if !@ids.nil? && @ids.length < 1 invalid_properties.push('invalid value for "ids", number of items must be greater than or equal to 1.') end @@ -120,37 +109,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @ids.nil? - return false if @ids.length < 1 + return false if !@ids.nil? && @ids.length < 1 hierarchy_mode_validator = EnumAttributeValidator.new('String', ["MANUAL"]) return false unless hierarchy_mode_validator.valid?(@hierarchy_mode) true end - # Custom attribute writer method with validation - # @param [Object] ids Value to be assigned - def ids=(ids) - if ids.nil? - fail ArgumentError, 'ids cannot be nil' - end - - if ids.length < 1 - fail ArgumentError, 'invalid value for "ids", number of items must be greater than or equal to 1.' - end - - @ids = ids - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] hierarchy_mode Object to be assigned - def hierarchy_mode=(hierarchy_mode) - validator = EnumAttributeValidator.new('String', ["MANUAL"]) - unless validator.valid?(hierarchy_mode) - fail ArgumentError, "invalid value for \"hierarchy_mode\", must be one of #{validator.allowable_values}." - end - @hierarchy_mode = hierarchy_mode - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotion_stack_tiers.rb b/lib/VoucherifySdk/models/promotion_stack_tiers.rb new file mode 100644 index 00000000..662bedd9 --- /dev/null +++ b/lib/VoucherifySdk/models/promotion_stack_tiers.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the tier configuration. A promotion stack can include up to 30 tiers. + class PromotionStackTiers + # Contains the list of tiers in a pre-defined sequence. + attr_accessor :ids + + attr_accessor :hierarchy_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ids' => :'ids', + :'hierarchy_mode' => :'hierarchy_mode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ids' => :'Array', + :'hierarchy_mode' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'ids', + :'hierarchy_mode' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'ids') + if (value = attributes[:'ids']).is_a?(Array) + self.ids = value + end + end + + if attributes.key?(:'hierarchy_mode') + self.hierarchy_mode = attributes[:'hierarchy_mode'] + else + self.hierarchy_mode = 'MANUAL' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ids.nil? && @ids.length < 1 + invalid_properties.push('invalid value for "ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ids.nil? && @ids.length < 1 + hierarchy_mode_validator = EnumAttributeValidator.new('String', ["MANUAL"]) + return false unless hierarchy_mode_validator.valid?(@hierarchy_mode) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ids == o.ids && + hierarchy_mode == o.hierarchy_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ids, hierarchy_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotion_tier.rb b/lib/VoucherifySdk/models/promotion_tier.rb index 70c85ec1..c2f54d2f 100644 --- a/lib/VoucherifySdk/models/promotion_tier.rb +++ b/lib/VoucherifySdk/models/promotion_tier.rb @@ -19,10 +19,10 @@ class PromotionTier # Unique promotion tier ID. attr_accessor :id - # Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Name of the promotion tier. @@ -58,12 +58,14 @@ class PromotionTier attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + attr_accessor :summary - # The type of object represented by JSON. This object stores information about the promotion tier. + # The type of the object represented by JSON. This object stores information about the promotion tier. attr_accessor :object attr_accessor :validation_rule_assignments @@ -73,6 +75,28 @@ class PromotionTier attr_accessor :categories + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -92,6 +116,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'summary' => :'summary', :'object' => :'object', :'validation_rule_assignments' => :'validation_rule_assignments', @@ -122,8 +147,9 @@ def self.openapi_types :'active' => :'Boolean', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'PromotionTierValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'summary' => :'PromotionTierSummary', :'object' => :'String', :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', @@ -135,21 +161,32 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTier` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -219,6 +256,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'summary') self.summary = attributes[:'summary'] end @@ -280,6 +321,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && summary == o.summary && object == o.object && validation_rule_assignments == o.validation_rule_assignments && @@ -296,7 +338,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, summary, object, validation_rule_assignments, category_id, categories].hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/promotion_tier_action.rb b/lib/VoucherifySdk/models/promotion_tier_action.rb index 98f766e9..ce86d8dd 100644 --- a/lib/VoucherifySdk/models/promotion_tier_action.rb +++ b/lib/VoucherifySdk/models/promotion_tier_action.rb @@ -46,15 +46,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierAction` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotion_tier_campaign.rb b/lib/VoucherifySdk/models/promotion_tier_campaign.rb index 84e6c6e0..fd402650 100644 --- a/lib/VoucherifySdk/models/promotion_tier_campaign.rb +++ b/lib/VoucherifySdk/models/promotion_tier_campaign.rb @@ -27,18 +27,42 @@ class PromotionTierCampaign attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the campaign is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign attr_accessor :active # Unique category ID that this campaign belongs to. attr_accessor :category_id - # The type of object represented by the campaign object. This object stores information about the campaign. + # The type of the object represented by the campaign object. This object stores information about the campaign. attr_accessor :object + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -47,6 +71,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'active' => :'active', :'category_id' => :'category_id', :'object' => :'object' @@ -64,8 +89,9 @@ def self.openapi_types :'id' => :'String', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'PromotionTierCampaignValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'active' => :'Boolean', :'category_id' => :'String', :'object' => :'String' @@ -75,21 +101,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierCampaign` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -115,6 +140,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'active') self.active = attributes[:'active'] end @@ -155,6 +184,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && active == o.active && category_id == o.category_id && object == o.object @@ -169,7 +199,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, category_id, object].hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/promotion_tier_campaign_validity_timeframe.rb b/lib/VoucherifySdk/models/promotion_tier_campaign_validity_timeframe.rb deleted file mode 100644 index 4946a705..00000000 --- a/lib/VoucherifySdk/models/promotion_tier_campaign_validity_timeframe.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day. - class PromotionTierCampaignValidityTimeframe - # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day. - attr_accessor :interval - - # Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day. - attr_accessor :duration - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'interval' => :'interval', - :'duration' => :'duration' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'interval' => :'String', - :'duration' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierCampaignValidityTimeframe` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierCampaignValidityTimeframe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'interval') - self.interval = attributes[:'interval'] - end - - if attributes.key?(:'duration') - self.duration = attributes[:'duration'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - interval == o.interval && - duration == o.duration - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [interval, duration].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/promotion_tier_create_params.rb b/lib/VoucherifySdk/models/promotion_tier_create_params.rb index 52e2aa7c..c0ec348b 100644 --- a/lib/VoucherifySdk/models/promotion_tier_create_params.rb +++ b/lib/VoucherifySdk/models/promotion_tier_create_params.rb @@ -44,15 +44,39 @@ class PromotionTierCreateParams attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # Assign category to the promotion tier. attr_accessor :category # Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`. attr_accessor :category_id + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -67,6 +91,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'category' => :'category', :'category_id' => :'category_id' } @@ -82,15 +107,16 @@ def self.openapi_types { :'name' => :'String', :'banner' => :'String', - :'action' => :'PromotionTierAction', + :'action' => :'PromotionTierCreateParamsAction', :'metadata' => :'Object', :'validation_rules' => :'Array', :'active' => :'Boolean', :'hierarchy' => :'Integer', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'PromotionTierValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'category' => :'String', :'category_id' => :'String' } @@ -99,28 +125,30 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'banner', + :'action', + :'metadata', + :'validation_rules', + :'active', + :'hierarchy', + :'start_date', + :'expiration_date', + :'category', + :'category_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierCreateParams` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierCreateParams`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'banner') @@ -167,6 +195,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'category') self.category = attributes[:'category'] end @@ -181,10 +213,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -192,7 +220,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? true end @@ -212,6 +239,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && category == o.category && category_id == o.category_id end @@ -225,7 +253,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, banner, action, metadata, validation_rules, active, hierarchy, start_date, expiration_date, validity_timeframe, validity_day_of_week, category, category_id].hash + [name, banner, action, metadata, validation_rules, active, hierarchy, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, category, category_id].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/promotion_tier_create_params_action.rb b/lib/VoucherifySdk/models/promotion_tier_create_params_action.rb new file mode 100644 index 00000000..2975bda2 --- /dev/null +++ b/lib/VoucherifySdk/models/promotion_tier_create_params_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionTierCreateParamsAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotion_tier_summary.rb b/lib/VoucherifySdk/models/promotion_tier_summary.rb index e6f77b72..b6ea8e90 100644 --- a/lib/VoucherifySdk/models/promotion_tier_summary.rb +++ b/lib/VoucherifySdk/models/promotion_tier_summary.rb @@ -44,21 +44,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'redemptions', + :'orders' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierSummary` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotion_tier_summary_orders.rb b/lib/VoucherifySdk/models/promotion_tier_summary_orders.rb index b379d078..a0824cff 100644 --- a/lib/VoucherifySdk/models/promotion_tier_summary_orders.rb +++ b/lib/VoucherifySdk/models/promotion_tier_summary_orders.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'total_amount', + :'total_discount_amount' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierSummaryOrders` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierSummaryOrders`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotion_tier_summary_redemptions.rb b/lib/VoucherifySdk/models/promotion_tier_summary_redemptions.rb index 918e3b3f..de2e2a1a 100644 --- a/lib/VoucherifySdk/models/promotion_tier_summary_redemptions.rb +++ b/lib/VoucherifySdk/models/promotion_tier_summary_redemptions.rb @@ -41,21 +41,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'total_redeemed' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierSummaryRedemptions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierSummaryRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotion_tier_validity_timeframe.rb b/lib/VoucherifySdk/models/promotion_tier_validity_timeframe.rb deleted file mode 100644 index 759b9077..00000000 --- a/lib/VoucherifySdk/models/promotion_tier_validity_timeframe.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`. - class PromotionTierValidityTimeframe - # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day. - attr_accessor :interval - - # Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day. - attr_accessor :duration - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'interval' => :'interval', - :'duration' => :'duration' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'interval' => :'String', - :'duration' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTierValidityTimeframe` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTierValidityTimeframe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'interval') - self.interval = attributes[:'interval'] - end - - if attributes.key?(:'duration') - self.duration = attributes[:'duration'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - interval == o.interval && - duration == o.duration - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [interval, duration].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/promotion_tiers_list.rb b/lib/VoucherifySdk/models/promotion_tiers_list.rb index 8ec34e6f..0fc57fc2 100644 --- a/lib/VoucherifySdk/models/promotion_tiers_list.rb +++ b/lib/VoucherifySdk/models/promotion_tiers_list.rb @@ -16,7 +16,7 @@ module VoucherifySdk # Promotion Tiers class PromotionTiersList - # The type of object represented by JSON. This object stores information about promotion tiers in a dictionary. + # The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of promotion tier objects. @@ -28,7 +28,7 @@ class PromotionTiersList # Total number of promotion tiers. attr_accessor :total - # As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. attr_accessor :has_more # Attribute mapping from ruby-style variable name to JSON key. @@ -61,21 +61,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'tiers', + :'total', + :'has_more' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionTiersList` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionTiersList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotions_stacks_create_request_body.rb b/lib/VoucherifySdk/models/promotions_stacks_create_request_body.rb index f9d2baa8..e0dad14e 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_create_request_body.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/promotions/{campaignId}/stacks`. + # Request body schema for **POST** `v1/promotions/{campaignId}/stacks`. class PromotionsStacksCreateRequestBody # Promotion stack name. attr_accessor :name @@ -42,7 +42,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'tiers' => :'PromotionStackBaseTiers', + :'tiers' => :'PromotionsStacksCreateRequestBodyTiers', :'category_id' => :'String' } end @@ -50,41 +50,26 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers', + :'category_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionStackBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'tiers') self.tiers = attributes[:'tiers'] - else - self.tiers = nil end if attributes.key?(:'category_id') @@ -97,14 +82,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @tiers.nil? - invalid_properties.push('invalid value for "tiers", tiers cannot be nil.') - end - invalid_properties end @@ -112,8 +89,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @tiers.nil? true end diff --git a/lib/VoucherifySdk/models/promotions_stacks_create_request_body_tiers.rb b/lib/VoucherifySdk/models/promotions_stacks_create_request_body_tiers.rb new file mode 100644 index 00000000..e0507d37 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_stacks_create_request_body_tiers.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the tier configuration. A promotion stack can include up to 30 tiers. + class PromotionsStacksCreateRequestBodyTiers + # Contains the list of tiers in a pre-defined sequence. + attr_accessor :ids + + attr_accessor :hierarchy_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ids' => :'ids', + :'hierarchy_mode' => :'hierarchy_mode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ids' => :'Array', + :'hierarchy_mode' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'ids', + :'hierarchy_mode' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'ids') + if (value = attributes[:'ids']).is_a?(Array) + self.ids = value + end + end + + if attributes.key?(:'hierarchy_mode') + self.hierarchy_mode = attributes[:'hierarchy_mode'] + else + self.hierarchy_mode = 'MANUAL' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ids.nil? && @ids.length < 1 + invalid_properties.push('invalid value for "ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ids.nil? && @ids.length < 1 + hierarchy_mode_validator = EnumAttributeValidator.new('String', ["MANUAL"]) + return false unless hierarchy_mode_validator.valid?(@hierarchy_mode) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ids == o.ids && + hierarchy_mode == o.hierarchy_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ids, hierarchy_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_stacks_create_response_body.rb b/lib/VoucherifySdk/models/promotions_stacks_create_response_body.rb index 14cdf277..025aa615 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_create_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/promotions/{campaignId}/stacks`. + # Response body schema for **POST** `v1/promotions/{campaignId}/stacks`. class PromotionsStacksCreateResponseBody # Promotion stack name. attr_accessor :name @@ -24,13 +24,13 @@ class PromotionsStacksCreateResponseBody # Unique promotion stack ID. attr_accessor :id - # Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Promotion stack's parent campaign's unique ID. attr_accessor :campaign_id - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Promotion stack category ID. @@ -84,7 +84,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'tiers' => :'PromotionStackBaseTiers', + :'tiers' => :'PromotionsStacksCreateResponseBodyTiers', :'id' => :'String', :'created_at' => :'Time', :'campaign_id' => :'String', @@ -97,60 +97,43 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers', + :'id', + :'created_at', + :'campaign_id', + :'object', :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionStackBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'tiers') self.tiers = attributes[:'tiers'] - else - self.tiers = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'object') @@ -161,16 +144,12 @@ def initialize(attributes = {}) if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end end @@ -179,34 +158,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @tiers.nil? - invalid_properties.push('invalid value for "tiers", tiers cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - invalid_properties end @@ -214,28 +165,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @tiers.nil? - return false if @id.nil? - return false if @created_at.nil? - return false if @campaign_id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["promotion_stack"]) return false unless object_validator.valid?(@object) - return false if @categories.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["promotion_stack"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotions_stacks_create_response_body_tiers.rb b/lib/VoucherifySdk/models/promotions_stacks_create_response_body_tiers.rb new file mode 100644 index 00000000..3165c0de --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_stacks_create_response_body_tiers.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the tier configuration. A promotion stack can include up to 30 tiers. + class PromotionsStacksCreateResponseBodyTiers + # Contains the list of tiers in a pre-defined sequence. + attr_accessor :ids + + attr_accessor :hierarchy_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ids' => :'ids', + :'hierarchy_mode' => :'hierarchy_mode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ids' => :'Array', + :'hierarchy_mode' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'ids', + :'hierarchy_mode' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'ids') + if (value = attributes[:'ids']).is_a?(Array) + self.ids = value + end + end + + if attributes.key?(:'hierarchy_mode') + self.hierarchy_mode = attributes[:'hierarchy_mode'] + else + self.hierarchy_mode = 'MANUAL' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ids.nil? && @ids.length < 1 + invalid_properties.push('invalid value for "ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ids.nil? && @ids.length < 1 + hierarchy_mode_validator = EnumAttributeValidator.new('String', ["MANUAL"]) + return false unless hierarchy_mode_validator.valid?(@hierarchy_mode) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ids == o.ids && + hierarchy_mode == o.hierarchy_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ids, hierarchy_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_stacks_get_response_body.rb b/lib/VoucherifySdk/models/promotions_stacks_get_response_body.rb index ec5ec3bd..b905916f 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_get_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/promotions/{campaignId}/stacks/{stackId}`. + # Response body schema for **GET** `v1/promotions/{campaignId}/stacks/{stackId}`. class PromotionsStacksGetResponseBody # Promotion stack name. attr_accessor :name @@ -24,16 +24,16 @@ class PromotionsStacksGetResponseBody # Unique promotion stack ID. attr_accessor :id - # Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Promotion stack's parent campaign's unique ID. attr_accessor :campaign_id - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Promotion stack category ID. @@ -88,7 +88,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'tiers' => :'PromotionStackBaseTiers', + :'tiers' => :'PromotionsStacksGetResponseBodyTiers', :'id' => :'String', :'created_at' => :'Time', :'updated_at' => :'Time', @@ -102,54 +102,40 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers', + :'id', + :'created_at', + :'updated_at', + :'campaign_id', + :'object', :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionStack' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'tiers') self.tiers = attributes[:'tiers'] - else - self.tiers = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -158,8 +144,6 @@ def initialize(attributes = {}) if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'object') @@ -170,16 +154,12 @@ def initialize(attributes = {}) if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end end @@ -188,34 +168,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @tiers.nil? - invalid_properties.push('invalid value for "tiers", tiers cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - invalid_properties end @@ -223,28 +175,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @tiers.nil? - return false if @id.nil? - return false if @created_at.nil? - return false if @campaign_id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["promotion_stack"]) return false unless object_validator.valid?(@object) - return false if @categories.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["promotion_stack"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotions_stacks_get_response_body_tiers.rb b/lib/VoucherifySdk/models/promotions_stacks_get_response_body_tiers.rb new file mode 100644 index 00000000..757075c7 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_stacks_get_response_body_tiers.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the tier configuration. A promotion stack can include up to 30 tiers. + class PromotionsStacksGetResponseBodyTiers + # Contains the list of tiers in a pre-defined sequence. + attr_accessor :ids + + attr_accessor :hierarchy_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ids' => :'ids', + :'hierarchy_mode' => :'hierarchy_mode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ids' => :'Array', + :'hierarchy_mode' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'ids', + :'hierarchy_mode' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'ids') + if (value = attributes[:'ids']).is_a?(Array) + self.ids = value + end + end + + if attributes.key?(:'hierarchy_mode') + self.hierarchy_mode = attributes[:'hierarchy_mode'] + else + self.hierarchy_mode = 'MANUAL' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ids.nil? && @ids.length < 1 + invalid_properties.push('invalid value for "ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ids.nil? && @ids.length < 1 + hierarchy_mode_validator = EnumAttributeValidator.new('String', ["MANUAL"]) + return false unless hierarchy_mode_validator.valid?(@hierarchy_mode) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ids == o.ids && + hierarchy_mode == o.hierarchy_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ids, hierarchy_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_stacks_list_response_body.rb b/lib/VoucherifySdk/models/promotions_stacks_list_response_body.rb index 8c490083..30fbed19 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_list_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/promotions/stacks` and for **GET** `/promotions/{campaignId}/stacks`. + # Response body schema for **GET** `v1/promotions/stacks` and for **GET** `v1/promotions/{campaignId}/stacks`. class PromotionsStacksListResponseBody - # The type of object represented by JSON. This object stores information about promotion stacks in a dictionary. + # The type of the object represented by JSON. This object stores information about promotion stacks in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of promotion stack objects. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,23 +121,7 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @total < 0 + if !@total.nil? && @total < 0 invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') end @@ -155,52 +132,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? - return false if @total < 0 + return false if !@total.nil? && @total < 0 true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - - # Custom attribute writer method with validation - # @param [Object] total Value to be assigned - def total=(total) - if total.nil? - fail ArgumentError, 'total cannot be nil' - end - - if total < 0 - fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' - end - - @total = total - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotions_stacks_update_request_body.rb b/lib/VoucherifySdk/models/promotions_stacks_update_request_body.rb index 0678b825..e0165e97 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_update_request_body.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request Body schema for **put** `/promotions/{campaignId}/stacks/{stackId}`. + # Request Body schema for **PUT** `v1/promotions/{campaignId}/stacks/{stackId}`. class PromotionsStacksUpdateRequestBody # Promotion stack name. attr_accessor :name @@ -50,21 +50,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers', + :'category_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotions_stacks_update_request_body_tiers.rb b/lib/VoucherifySdk/models/promotions_stacks_update_request_body_tiers.rb index 24c9e6f4..3b381311 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_update_request_body_tiers.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_update_request_body_tiers.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Contains the tier configuration. + # Contains the tier configuration. A promotion stack can include up to 30 tiers. class PromotionsStacksUpdateRequestBodyTiers # Contains the list of tiers in a pre-defined sequence. attr_accessor :ids @@ -68,21 +68,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'ids', + :'hierarchy_mode' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksUpdateRequestBodyTiers` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksUpdateRequestBodyTiers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -116,16 +111,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] hierarchy_mode Object to be assigned - def hierarchy_mode=(hierarchy_mode) - validator = EnumAttributeValidator.new('String', ["MANUAL"]) - unless validator.valid?(hierarchy_mode) - fail ArgumentError, "invalid value for \"hierarchy_mode\", must be one of #{validator.allowable_values}." - end - @hierarchy_mode = hierarchy_mode - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotions_stacks_update_response_body.rb b/lib/VoucherifySdk/models/promotions_stacks_update_response_body.rb index 0ee50ded..45e2edaa 100644 --- a/lib/VoucherifySdk/models/promotions_stacks_update_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_stacks_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/promotions/{campaignId}/stacks/{stackId}`. + # Response body schema for **PUT** `v1/promotions/{campaignId}/stacks/{stackId}`. class PromotionsStacksUpdateResponseBody # Promotion stack name. attr_accessor :name @@ -24,16 +24,16 @@ class PromotionsStacksUpdateResponseBody # Unique promotion stack ID. attr_accessor :id - # Timestamp representing the date and time when the promotion stack was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Promotion stack's parent campaign's unique ID. attr_accessor :campaign_id - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Promotion stack category ID. @@ -88,7 +88,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'tiers' => :'PromotionStackBaseTiers', + :'tiers' => :'PromotionsStacksUpdateResponseBodyTiers', :'id' => :'String', :'created_at' => :'Time', :'updated_at' => :'Time', @@ -102,66 +102,48 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'tiers', + :'id', + :'created_at', + :'updated_at', + :'campaign_id', + :'object', :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionStackBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsStacksUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsStacksUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'tiers') self.tiers = attributes[:'tiers'] - else - self.tiers = nil end if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'object') @@ -172,16 +154,12 @@ def initialize(attributes = {}) if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] - else - self.category_id = nil end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end - else - self.categories = nil end end @@ -190,38 +168,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @tiers.nil? - invalid_properties.push('invalid value for "tiers", tiers cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @updated_at.nil? - invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @categories.nil? - invalid_properties.push('invalid value for "categories", categories cannot be nil.') - end - invalid_properties end @@ -229,29 +175,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @tiers.nil? - return false if @id.nil? - return false if @created_at.nil? - return false if @updated_at.nil? - return false if @campaign_id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["promotion_stack"]) return false unless object_validator.valid?(@object) - return false if @categories.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["promotion_stack"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/promotions_stacks_update_response_body_tiers.rb b/lib/VoucherifySdk/models/promotions_stacks_update_response_body_tiers.rb new file mode 100644 index 00000000..a26f4ca6 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_stacks_update_response_body_tiers.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the tier configuration. A promotion stack can include up to 30 tiers. + class PromotionsStacksUpdateResponseBodyTiers + # Contains the list of tiers in a pre-defined sequence. + attr_accessor :ids + + attr_accessor :hierarchy_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ids' => :'ids', + :'hierarchy_mode' => :'hierarchy_mode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ids' => :'Array', + :'hierarchy_mode' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'ids', + :'hierarchy_mode' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'ids') + if (value = attributes[:'ids']).is_a?(Array) + self.ids = value + end + end + + if attributes.key?(:'hierarchy_mode') + self.hierarchy_mode = attributes[:'hierarchy_mode'] + else + self.hierarchy_mode = 'MANUAL' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ids.nil? && @ids.length < 1 + invalid_properties.push('invalid value for "ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ids.nil? && @ids.length < 1 + hierarchy_mode_validator = EnumAttributeValidator.new('String', ["MANUAL"]) + return false unless hierarchy_mode_validator.valid?(@hierarchy_mode) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ids == o.ids && + hierarchy_mode == o.hierarchy_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ids, hierarchy_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_request_body.rb b/lib/VoucherifySdk/models/promotions_tiers_create_request_body.rb new file mode 100644 index 00000000..91f0e401 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_request_body.rb @@ -0,0 +1,369 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request body schema for **POST** `v1/v1/promotions/{campaignId}/tiers`. + class PromotionsTiersCreateRequestBody + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + # The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + attr_accessor :active + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :validation_rule_assignments + + # Assign a new or update the promotion tier's category using name. + attr_accessor :category + + # Assign a new or update the promotion tier's category using id + attr_accessor :category_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category' => :'category', + :'category_id' => :'category_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'banner' => :'String', + :'action' => :'PromotionsTiersCreateRequestBodyAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category' => :'String', + :'category_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'active', + :'start_date', + :'expiration_date', + :'category', + :'category_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + validation_rule_assignments == o.validation_rule_assignments && + category == o.category && + category_id == o.category_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, banner, action, metadata, hierarchy, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, validation_rule_assignments, category, category_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_request_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_create_request_body_action.rb new file mode 100644 index 00000000..a16bde2a --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_request_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersCreateRequestBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_response_body.rb b/lib/VoucherifySdk/models/promotions_tiers_create_response_body.rb new file mode 100644 index 00000000..006ac8bc --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_response_body.rb @@ -0,0 +1,458 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/promotions/{campaignId}/tiers`. + class PromotionsTiersCreateResponseBody + # Unique promotion tier ID. + attr_accessor :id + + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + # The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # Promotion unique ID. + attr_accessor :promotion_id + + attr_accessor :campaign + + # Promotion tier's parent campaign's unique ID. + attr_accessor :campaign_id + + # A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + attr_accessor :active + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :summary + + # The type of the object represented by JSON. This object stores information about the promotion tier. + attr_accessor :object + + attr_accessor :validation_rule_assignments + + # Promotion tier category ID. + attr_accessor :category_id + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'promotion_id' => :'promotion_id', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'summary' => :'summary', + :'object' => :'object', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category_id' => :'category_id', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'name' => :'String', + :'banner' => :'String', + :'action' => :'PromotionsTiersCreateResponseBodyAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'promotion_id' => :'String', + :'campaign' => :'PromotionsTiersCreateResponseBodyCampaign', + :'campaign_id' => :'String', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'summary' => :'PromotionsTiersCreateResponseBodySummary', + :'object' => :'String', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category_id' => :'String', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'promotion_id') + self.promotion_id = attributes[:'promotion_id'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'promotion_tier' + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + updated_at == o.updated_at && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + promotion_id == o.promotion_id && + campaign == o.campaign && + campaign_id == o.campaign_id && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + summary == o.summary && + object == o.object && + validation_rule_assignments == o.validation_rule_assignments && + category_id == o.category_id && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_response_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_action.rb new file mode 100644 index 00000000..b13cdfa6 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersCreateResponseBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_response_body_campaign.rb b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_campaign.rb new file mode 100644 index 00000000..3e2e78e3 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_campaign.rb @@ -0,0 +1,319 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about promotion tier's parent campaign. + class PromotionsTiersCreateResponseBodyCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary.rb b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary.rb new file mode 100644 index 00000000..f6aeba88 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions and orders. + class PromotionsTiersCreateResponseBodySummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'PromotionsTiersCreateResponseBodySummaryRedemptions', + :'orders' => :'PromotionsTiersCreateResponseBodySummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary_orders.rb b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary_orders.rb new file mode 100644 index 00000000..a7a40b0b --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary_orders.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about orders related to the promotion tier. + class PromotionsTiersCreateResponseBodySummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary_redemptions.rb b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary_redemptions.rb new file mode 100644 index 00000000..8a5fdcea --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_create_response_body_summary_redemptions.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions. + class PromotionsTiersCreateResponseBodySummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body.rb b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body.rb index 0240274b..9a50ccdc 100644 --- a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/promotions/tiers/{promotionTierId}/disable`. + # Response body schema for **POST** `v1/promotions/tiers/{promotionTierId}/disable`. class PromotionsTiersDisableResponseBody # Unique promotion tier ID. attr_accessor :id - # Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Name of the promotion tier. @@ -58,12 +58,14 @@ class PromotionsTiersDisableResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + attr_accessor :summary - # The type of object represented by JSON. This object stores information about the promotion tier. + # The type of the object represented by JSON. This object stores information about the promotion tier. attr_accessor :object attr_accessor :validation_rule_assignments @@ -73,6 +75,28 @@ class PromotionsTiersDisableResponseBody attr_accessor :categories + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -92,6 +116,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'summary' => :'summary', :'object' => :'object', :'validation_rule_assignments' => :'validation_rule_assignments', @@ -113,18 +138,19 @@ def self.openapi_types :'updated_at' => :'Time', :'name' => :'String', :'banner' => :'String', - :'action' => :'PromotionTierAction', + :'action' => :'PromotionsTiersDisableResponseBodyAction', :'metadata' => :'Object', :'hierarchy' => :'Integer', :'promotion_id' => :'String', - :'campaign' => :'PromotionTierCampaign', + :'campaign' => :'PromotionsTiersDisableResponseBodyCampaign', :'campaign_id' => :'String', :'active' => :'Boolean', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'PromotionTierValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', - :'summary' => :'PromotionTierSummary', + :'validity_hours' => :'ValidityHours', + :'summary' => :'PromotionsTiersDisableResponseBodySummary', :'object' => :'String', :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', :'category_id' => :'String', @@ -135,28 +161,32 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionTier' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsTiersDisableResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsTiersDisableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -226,6 +256,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'summary') self.summary = attributes[:'summary'] end @@ -287,6 +321,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && summary == o.summary && object == o.object && validation_rule_assignments == o.validation_rule_assignments && @@ -303,7 +338,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, summary, object, validation_rule_assignments, category_id, categories].hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_action.rb new file mode 100644 index 00000000..8e237bda --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersDisableResponseBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_campaign.rb b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_campaign.rb new file mode 100644 index 00000000..79a9833d --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_campaign.rb @@ -0,0 +1,319 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about promotion tier's parent campaign. + class PromotionsTiersDisableResponseBodyCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary.rb b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary.rb new file mode 100644 index 00000000..952214b2 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions and orders. + class PromotionsTiersDisableResponseBodySummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'PromotionsTiersDisableResponseBodySummaryRedemptions', + :'orders' => :'PromotionsTiersDisableResponseBodySummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary_orders.rb b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary_orders.rb new file mode 100644 index 00000000..a9a9b474 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary_orders.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about orders related to the promotion tier. + class PromotionsTiersDisableResponseBodySummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary_redemptions.rb b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary_redemptions.rb new file mode 100644 index 00000000..ac59e339 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_disable_response_body_summary_redemptions.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions. + class PromotionsTiersDisableResponseBodySummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body.rb b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body.rb index 512ac1d1..4d83ed1a 100644 --- a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/promotions/tiers/{promotionTierId}/enable`. + # Response body schema for **POST** `v1/promotions/tiers/{promotionTierId}/enable`. class PromotionsTiersEnableResponseBody # Unique promotion tier ID. attr_accessor :id - # Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Name of the promotion tier. @@ -58,12 +58,14 @@ class PromotionsTiersEnableResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + attr_accessor :summary - # The type of object represented by JSON. This object stores information about the promotion tier. + # The type of the object represented by JSON. This object stores information about the promotion tier. attr_accessor :object attr_accessor :validation_rule_assignments @@ -73,6 +75,28 @@ class PromotionsTiersEnableResponseBody attr_accessor :categories + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -92,6 +116,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'summary' => :'summary', :'object' => :'object', :'validation_rule_assignments' => :'validation_rule_assignments', @@ -113,18 +138,19 @@ def self.openapi_types :'updated_at' => :'Time', :'name' => :'String', :'banner' => :'String', - :'action' => :'PromotionTierAction', + :'action' => :'PromotionsTiersEnableResponseBodyAction', :'metadata' => :'Object', :'hierarchy' => :'Integer', :'promotion_id' => :'String', - :'campaign' => :'PromotionTierCampaign', + :'campaign' => :'PromotionsTiersEnableResponseBodyCampaign', :'campaign_id' => :'String', :'active' => :'Boolean', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'PromotionTierValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', - :'summary' => :'PromotionTierSummary', + :'validity_hours' => :'ValidityHours', + :'summary' => :'PromotionsTiersEnableResponseBodySummary', :'object' => :'String', :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', :'category_id' => :'String', @@ -135,28 +161,32 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionTier' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsTiersEnableResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsTiersEnableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -226,6 +256,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'summary') self.summary = attributes[:'summary'] end @@ -287,6 +321,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && summary == o.summary && object == o.object && validation_rule_assignments == o.validation_rule_assignments && @@ -303,7 +338,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, summary, object, validation_rule_assignments, category_id, categories].hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_action.rb new file mode 100644 index 00000000..6bc16a76 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersEnableResponseBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_campaign.rb b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_campaign.rb new file mode 100644 index 00000000..5f88d4f1 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_campaign.rb @@ -0,0 +1,319 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about promotion tier's parent campaign. + class PromotionsTiersEnableResponseBodyCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary.rb b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary.rb new file mode 100644 index 00000000..5ca5b744 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions and orders. + class PromotionsTiersEnableResponseBodySummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'PromotionsTiersEnableResponseBodySummaryRedemptions', + :'orders' => :'PromotionsTiersEnableResponseBodySummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary_orders.rb b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary_orders.rb new file mode 100644 index 00000000..53dca16a --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary_orders.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about orders related to the promotion tier. + class PromotionsTiersEnableResponseBodySummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary_redemptions.rb b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary_redemptions.rb new file mode 100644 index 00000000..e822d650 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_enable_response_body_summary_redemptions.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions. + class PromotionsTiersEnableResponseBodySummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_get_response_body.rb b/lib/VoucherifySdk/models/promotions_tiers_get_response_body.rb index 2fd138f3..4d96dbc9 100644 --- a/lib/VoucherifySdk/models/promotions_tiers_get_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_tiers_get_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/promotions/tiers/{promotionTierId}`. + # Response body schema for **GET** `v1/promotions/tiers/{promotionTierId}`. class PromotionsTiersGetResponseBody # Unique promotion tier ID. attr_accessor :id - # Timestamp representing the date and time when the promotion tier was created in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format. + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # Name of the promotion tier. @@ -58,12 +58,14 @@ class PromotionsTiersGetResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the promotion tier is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + attr_accessor :summary - # The type of object represented by JSON. This object stores information about the promotion tier. + # The type of the object represented by JSON. This object stores information about the promotion tier. attr_accessor :object attr_accessor :validation_rule_assignments @@ -73,6 +75,28 @@ class PromotionsTiersGetResponseBody attr_accessor :categories + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -92,6 +116,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'summary' => :'summary', :'object' => :'object', :'validation_rule_assignments' => :'validation_rule_assignments', @@ -113,18 +138,19 @@ def self.openapi_types :'updated_at' => :'Time', :'name' => :'String', :'banner' => :'String', - :'action' => :'PromotionTierAction', + :'action' => :'PromotionsTiersGetResponseBodyAction', :'metadata' => :'Object', :'hierarchy' => :'Integer', :'promotion_id' => :'String', - :'campaign' => :'PromotionTierCampaign', + :'campaign' => :'PromotionsTiersGetResponseBodyCampaign', :'campaign_id' => :'String', :'active' => :'Boolean', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'PromotionTierValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', - :'summary' => :'PromotionTierSummary', + :'validity_hours' => :'ValidityHours', + :'summary' => :'PromotionsTiersGetResponseBodySummary', :'object' => :'String', :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', :'category_id' => :'String', @@ -135,28 +161,32 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionTier' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsTiersGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsTiersGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -226,6 +256,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'summary') self.summary = attributes[:'summary'] end @@ -287,6 +321,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && summary == o.summary && object == o.object && validation_rule_assignments == o.validation_rule_assignments && @@ -303,7 +338,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, summary, object, validation_rule_assignments, category_id, categories].hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/promotions_tiers_get_response_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_action.rb new file mode 100644 index 00000000..70a8f162 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersGetResponseBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_get_response_body_campaign.rb b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_campaign.rb new file mode 100644 index 00000000..f27567fe --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_campaign.rb @@ -0,0 +1,319 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about promotion tier's parent campaign. + class PromotionsTiersGetResponseBodyCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary.rb b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary.rb new file mode 100644 index 00000000..19c2b200 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions and orders. + class PromotionsTiersGetResponseBodySummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'PromotionsTiersGetResponseBodySummaryRedemptions', + :'orders' => :'PromotionsTiersGetResponseBodySummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary_orders.rb b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary_orders.rb new file mode 100644 index 00000000..d451f9e9 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary_orders.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about orders related to the promotion tier. + class PromotionsTiersGetResponseBodySummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary_redemptions.rb b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary_redemptions.rb new file mode 100644 index 00000000..fa0e9585 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_get_response_body_summary_redemptions.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions. + class PromotionsTiersGetResponseBodySummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_list_response_body.rb b/lib/VoucherifySdk/models/promotions_tiers_list_response_body.rb index f4d2b095..4d4cc715 100644 --- a/lib/VoucherifySdk/models/promotions_tiers_list_response_body.rb +++ b/lib/VoucherifySdk/models/promotions_tiers_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/promotions/{campaignId}/tiers`. + # Response body schema for **GET** `v1/promotions/{campaignId}/tiers` and **GET** `v1/promotions/tiers`. class PromotionsTiersListResponseBody - # The type of object represented by JSON. This object stores information about promotion tiers in a dictionary. + # The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of promotion tier objects. @@ -28,7 +28,7 @@ class PromotionsTiersListResponseBody # Total number of promotion tiers. attr_accessor :total - # As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. attr_accessor :has_more # Attribute mapping from ruby-style variable name to JSON key. @@ -61,28 +61,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'tiers', + :'total', + :'has_more' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PromotionTiersList' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PromotionsTiersListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PromotionsTiersListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_request_body.rb b/lib/VoucherifySdk/models/promotions_tiers_update_request_body.rb new file mode 100644 index 00000000..6edfffea --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_request_body.rb @@ -0,0 +1,358 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request body schema for **PUT** `v1/promotions/tiers/{promotionTierId}`. + class PromotionsTiersUpdateRequestBody + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + # The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :validation_rule_assignments + + # Assign a new or update the promotion tier's category using name. + attr_accessor :category + + # Assign a new or update the promotion tier's category using id + attr_accessor :category_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category' => :'category', + :'category_id' => :'category_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'banner' => :'String', + :'action' => :'PromotionsTiersUpdateRequestBodyAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category' => :'String', + :'category_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'start_date', + :'expiration_date', + :'category', + :'category_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + validation_rule_assignments == o.validation_rule_assignments && + category == o.category && + category_id == o.category_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, banner, action, metadata, hierarchy, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, validation_rule_assignments, category, category_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_request_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_update_request_body_action.rb new file mode 100644 index 00000000..91976dfa --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_request_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersUpdateRequestBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_response_body.rb b/lib/VoucherifySdk/models/promotions_tiers_update_response_body.rb new file mode 100644 index 00000000..b91363f2 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_response_body.rb @@ -0,0 +1,458 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `v1/promotions/tiers/{promotionTierId}`. + class PromotionsTiersUpdateResponseBody + # Unique promotion tier ID. + attr_accessor :id + + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + # The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # Promotion unique ID. + attr_accessor :promotion_id + + attr_accessor :campaign + + # Promotion tier's parent campaign's unique ID. + attr_accessor :campaign_id + + # A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + attr_accessor :active + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :summary + + # The type of the object represented by JSON. This object stores information about the promotion tier. + attr_accessor :object + + attr_accessor :validation_rule_assignments + + # Promotion tier category ID. + attr_accessor :category_id + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'promotion_id' => :'promotion_id', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'summary' => :'summary', + :'object' => :'object', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category_id' => :'category_id', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'name' => :'String', + :'banner' => :'String', + :'action' => :'PromotionsTiersUpdateResponseBodyAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'promotion_id' => :'String', + :'campaign' => :'PromotionsTiersUpdateResponseBodyCampaign', + :'campaign_id' => :'String', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'summary' => :'PromotionsTiersUpdateResponseBodySummary', + :'object' => :'String', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category_id' => :'String', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'promotion_id') + self.promotion_id = attributes[:'promotion_id'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'promotion_tier' + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + updated_at == o.updated_at && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + promotion_id == o.promotion_id && + campaign == o.campaign && + campaign_id == o.campaign_id && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + summary == o.summary && + object == o.object && + validation_rule_assignments == o.validation_rule_assignments && + category_id == o.category_id && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_response_body_action.rb b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_action.rb new file mode 100644 index 00000000..9a8d24f4 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_action.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about the discount applied by the promotion tier. + class PromotionsTiersUpdateResponseBodyAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_response_body_campaign.rb b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_campaign.rb new file mode 100644 index 00000000..721e1cb9 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_campaign.rb @@ -0,0 +1,319 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains details about promotion tier's parent campaign. + class PromotionsTiersUpdateResponseBodyCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary.rb b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary.rb new file mode 100644 index 00000000..093a78cc --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions and orders. + class PromotionsTiersUpdateResponseBodySummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'PromotionsTiersUpdateResponseBodySummaryRedemptions', + :'orders' => :'PromotionsTiersUpdateResponseBodySummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary_orders.rb b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary_orders.rb new file mode 100644 index 00000000..cf5f78ce --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary_orders.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about orders related to the promotion tier. + class PromotionsTiersUpdateResponseBodySummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary_redemptions.rb b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary_redemptions.rb new file mode 100644 index 00000000..b3b403d1 --- /dev/null +++ b/lib/VoucherifySdk/models/promotions_tiers_update_response_body_summary_redemptions.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains statistics about promotion tier redemptions. + class PromotionsTiersUpdateResponseBodySummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/properties_for_loyalty_campaign_options.rb b/lib/VoucherifySdk/models/properties_for_loyalty_campaign_options.rb deleted file mode 100644 index 3671314c..00000000 --- a/lib/VoucherifySdk/models/properties_for_loyalty_campaign_options.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class PropertiesForLoyaltyCampaignOptions - # Determine if tiers should be recalculated or no. - attr_accessor :recalculate_tiers - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'recalculate_tiers' => :'recalculate_tiers' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'recalculate_tiers' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PropertiesForLoyaltyCampaignOptions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PropertiesForLoyaltyCampaignOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'recalculate_tiers') - self.recalculate_tiers = attributes[:'recalculate_tiers'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - recalculate_tiers == o.recalculate_tiers - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [recalculate_tiers].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/publications_create_base_response_body.rb b/lib/VoucherifySdk/models/publications_create_base_response_body.rb deleted file mode 100644 index 62f609bd..00000000 --- a/lib/VoucherifySdk/models/publications_create_base_response_body.rb +++ /dev/null @@ -1,440 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class PublicationsCreateBaseResponseBody - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - # Status of the publication attempt. - attr_accessor :result - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'result' => :'result', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'result' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PublicationsCreateBaseResponseBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PublicationsCreateBaseResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = 'API' - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = 'SUCCESS' - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - channel_validator = EnumAttributeValidator.new('String', ["API"]) - return false unless channel_validator.valid?(@channel) - return false if @result.nil? - result_validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - return false unless result_validator.valid?(@result) - return false if @customer.nil? - return false if @vouchers_id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["API"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - result == o.result && - customer == o.customer && - vouchers_id == o.vouchers_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, result, customer, vouchers_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/publications_create_request_body.rb b/lib/VoucherifySdk/models/publications_create_request_body.rb index c9adead7..aca58f47 100644 --- a/lib/VoucherifySdk/models/publications_create_request_body.rb +++ b/lib/VoucherifySdk/models/publications_create_request_body.rb @@ -14,93 +14,247 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/publications`. - module PublicationsCreateRequestBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'CreatePublicationWithCampaign', - :'CreatePublicationWithSpecificVoucher' - ] + class PublicationsCreateRequestBody + # Code of the voucher being published. + attr_accessor :voucher + + # The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. + attr_accessor :source_id + + attr_accessor :customer + + attr_accessor :metadata + + # Specify the distribution channel. + attr_accessor :channel + + attr_accessor :campaign + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'voucher' => :'voucher', + :'source_id' => :'source_id', + :'customer' => :'customer', + :'metadata' => :'metadata', + :'channel' => :'channel', + :'campaign' => :'campaign' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'voucher' => :'String', + :'source_id' => :'String', + :'customer' => :'PublicationsCreateRequestBodyCustomer', + :'metadata' => :'Object', + :'channel' => :'String', + :'campaign' => :'CreatePublicationCampaign' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'voucher', + :'source_id', + :'customer', + :'metadata', + :'channel', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] end - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end - openapi_one_of.include?(:AnyType) ? data : nil + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + voucher == o.voucher && + source_id == o.source_id && + customer == o.customer && + metadata == o.metadata && + channel == o.channel && + campaign == o.campaign + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [voucher, source_id, customer, metadata, channel, campaign].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value end end + end end diff --git a/lib/VoucherifySdk/models/publications_create_request_body_customer.rb b/lib/VoucherifySdk/models/publications_create_request_body_customer.rb new file mode 100644 index 00000000..cd56c475 --- /dev/null +++ b/lib/VoucherifySdk/models/publications_create_request_body_customer.rb @@ -0,0 +1,306 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class PublicationsCreateRequestBodyCustomer + # The ID of an existing customer. + attr_accessor :id + + # A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + attr_accessor :source_id + + # Customer's first and last name. + attr_accessor :name + + # An arbitrary string that you can attach to a customer object. + attr_accessor :description + + # Customer's email address. + attr_accessor :email + + # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + attr_accessor :phone + + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + attr_accessor :birthday + + # Customer's birthdate; format YYYY-MM-DD. + attr_accessor :birthdate + + attr_accessor :address + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'name' => :'name', + :'description' => :'description', + :'email' => :'email', + :'phone' => :'phone', + :'birthday' => :'birthday', + :'birthdate' => :'birthdate', + :'address' => :'address', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'birthday' => :'Date', + :'birthdate' => :'Date', + :'address' => :'PublicationsCreateRequestBodyCustomerAddress', + :'metadata' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', + :'address', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'birthday') + self.birthday = attributes[:'birthday'] + end + + if attributes.key?(:'birthdate') + self.birthdate = attributes[:'birthdate'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + name == o.name && + description == o.description && + email == o.email && + phone == o.phone && + birthday == o.birthday && + birthdate == o.birthdate && + address == o.address && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, name, description, email, phone, birthday, birthdate, address, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/publications_create_request_body_customer_address.rb b/lib/VoucherifySdk/models/publications_create_request_body_customer_address.rb new file mode 100644 index 00000000..16dc2de0 --- /dev/null +++ b/lib/VoucherifySdk/models/publications_create_request_body_customer_address.rb @@ -0,0 +1,264 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class PublicationsCreateRequestBodyCustomerAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/publications_create_response_body.rb b/lib/VoucherifySdk/models/publications_create_response_body.rb index af3089d1..a40230f5 100644 --- a/lib/VoucherifySdk/models/publications_create_response_body.rb +++ b/lib/VoucherifySdk/models/publications_create_response_body.rb @@ -14,93 +14,361 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/publication` and **GET** `/publications/create`. - module PublicationsCreateResponseBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'PublicationsCreateVoucherResponseBody', - :'PublicationsCreateVouchersResponseBody' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class PublicationsCreateResponseBody + # Unique publication ID, assigned by Voucherify. + attr_accessor :id + + # The type of the object represented by the JSON. This object stores information about the `publication`. + attr_accessor :object + + # Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Unique customer ID of the customer receiving the publication. + attr_accessor :customer_id + + # Customer's `source_id`. + attr_accessor :tracking_id + + attr_accessor :metadata + + # How the publication was originated. It can be your own custom channel or an example value provided here. + attr_accessor :channel + + # The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. + attr_accessor :source_id + + # Status of the publication attempt. + attr_accessor :result + + attr_accessor :customer + + # Contains the unique internal voucher ID that was assigned by Voucherify. + attr_accessor :vouchers_id + + attr_accessor :voucher + + # Contains the unique voucher codes that was assigned by Voucherify. + attr_accessor :vouchers + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'customer_id' => :'customer_id', + :'tracking_id' => :'tracking_id', + :'metadata' => :'metadata', + :'channel' => :'channel', + :'source_id' => :'source_id', + :'result' => :'result', + :'customer' => :'customer', + :'vouchers_id' => :'vouchers_id', + :'voucher' => :'voucher', + :'vouchers' => :'vouchers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Time', + :'customer_id' => :'String', + :'tracking_id' => :'String', + :'metadata' => :'Object', + :'channel' => :'String', + :'source_id' => :'String', + :'result' => :'String', + :'customer' => :'CustomerWithSummaryLoyaltyReferrals', + :'vouchers_id' => :'Array', + :'voucher' => :'Voucher', + :'vouchers' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'created_at', + :'customer_id', + :'tracking_id', + :'metadata', + :'channel', + :'source_id', + :'result', + :'vouchers_id', + :'vouchers' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'publication' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + else + self.channel = 'API' + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + else + self.result = 'SUCCESS' + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'vouchers_id') + if (value = attributes[:'vouchers_id']).is_a?(Array) + self.vouchers_id = value + end + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'vouchers') + if (value = attributes[:'vouchers']).is_a?(Array) + self.vouchers = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["publication"]) + return false unless object_validator.valid?(@object) + channel_validator = EnumAttributeValidator.new('String', ["API"]) + return false unless channel_validator.valid?(@channel) + result_validator = EnumAttributeValidator.new('String', ["SUCCESS"]) + return false unless result_validator.valid?(@result) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + customer_id == o.customer_id && + tracking_id == o.tracking_id && + metadata == o.metadata && + channel == o.channel && + source_id == o.source_id && + result == o.result && + customer == o.customer && + vouchers_id == o.vouchers_id && + voucher == o.voucher && + vouchers == o.vouchers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, result, customer, vouchers_id, voucher, vouchers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/publications_create_voucher_response_body.rb b/lib/VoucherifySdk/models/publications_create_voucher_response_body.rb deleted file mode 100644 index a7b3d14e..00000000 --- a/lib/VoucherifySdk/models/publications_create_voucher_response_body.rb +++ /dev/null @@ -1,464 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/publication` and **GET** `/publications/create`. - class PublicationsCreateVoucherResponseBody - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - # Status of the publication attempt. - attr_accessor :result - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - attr_accessor :voucher - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'result' => :'result', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id', - :'voucher' => :'voucher' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'result' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array', - :'voucher' => :'Voucher' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PublicationsCreateBaseResponseBody' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PublicationsCreateVoucherResponseBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PublicationsCreateVoucherResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = 'API' - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = 'SUCCESS' - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - else - self.voucher = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - if @voucher.nil? - invalid_properties.push('invalid value for "voucher", voucher cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - channel_validator = EnumAttributeValidator.new('String', ["API"]) - return false unless channel_validator.valid?(@channel) - return false if @result.nil? - result_validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - return false unless result_validator.valid?(@result) - return false if @customer.nil? - return false if @vouchers_id.nil? - return false if @voucher.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["API"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - result == o.result && - customer == o.customer && - vouchers_id == o.vouchers_id && - voucher == o.voucher - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, result, customer, vouchers_id, voucher].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/publications_create_vouchers_response_body.rb b/lib/VoucherifySdk/models/publications_create_vouchers_response_body.rb deleted file mode 100644 index 2cd7a971..00000000 --- a/lib/VoucherifySdk/models/publications_create_vouchers_response_body.rb +++ /dev/null @@ -1,467 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Response body schema for **POST** `/publication` and **GET** `/publications/create`. - class PublicationsCreateVouchersResponseBody - # Unique publication ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `publication`. - attr_accessor :object - - # Timestamp representing the date and time when the publication was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer receiving the publication. - attr_accessor :customer_id - - # Customer's `source_id`. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. - attr_accessor :metadata - - # How the publication was originated. It can be your own custom channel or an example value provided here. - attr_accessor :channel - - # The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. - attr_accessor :source_id - - # Status of the publication attempt. - attr_accessor :result - - attr_accessor :customer - - # Contains the unique internal voucher ID that was assigned by Voucherify. - attr_accessor :vouchers_id - - # Contains the unique voucher codes that was assigned by Voucherify. - attr_accessor :vouchers - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel' => :'channel', - :'source_id' => :'source_id', - :'result' => :'result', - :'customer' => :'customer', - :'vouchers_id' => :'vouchers_id', - :'vouchers' => :'vouchers' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel' => :'String', - :'source_id' => :'String', - :'result' => :'String', - :'customer' => :'CustomerWithSummaryLoyaltyReferrals', - :'vouchers_id' => :'Array', - :'vouchers' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'PublicationsCreateBaseResponseBody' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PublicationsCreateVouchersResponseBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PublicationsCreateVouchersResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'publication' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = 'API' - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = 'SUCCESS' - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - else - self.customer = nil - end - - if attributes.key?(:'vouchers_id') - if (value = attributes[:'vouchers_id']).is_a?(Array) - self.vouchers_id = value - end - else - self.vouchers_id = nil - end - - if attributes.key?(:'vouchers') - if (value = attributes[:'vouchers']).is_a?(Array) - self.vouchers = value - end - else - self.vouchers = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @customer_id.nil? - invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @customer.nil? - invalid_properties.push('invalid value for "customer", customer cannot be nil.') - end - - if @vouchers_id.nil? - invalid_properties.push('invalid value for "vouchers_id", vouchers_id cannot be nil.') - end - - if @vouchers.nil? - invalid_properties.push('invalid value for "vouchers", vouchers cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["publication"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @customer_id.nil? - return false if @metadata.nil? - return false if @channel.nil? - channel_validator = EnumAttributeValidator.new('String', ["API"]) - return false unless channel_validator.valid?(@channel) - return false if @result.nil? - result_validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - return false unless result_validator.valid?(@result) - return false if @customer.nil? - return false if @vouchers_id.nil? - return false if @vouchers.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["publication"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["API"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel == o.channel && - source_id == o.source_id && - result == o.result && - customer == o.customer && - vouchers_id == o.vouchers_id && - vouchers == o.vouchers - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, result, customer, vouchers_id, vouchers].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/publications_list_response_body.rb b/lib/VoucherifySdk/models/publications_list_response_body.rb index 90277aac..e58f2103 100644 --- a/lib/VoucherifySdk/models/publications_list_response_body.rb +++ b/lib/VoucherifySdk/models/publications_list_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for listing publications using **GET** `/publications`. + # Response body schema for listing publications using **GET** `v1/publications`. class PublicationsListResponseBody - # The type of object represented by JSON. This object stores information about publications in a dictionary. + # The type of the object represented by JSON. This object stores information about publications in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of publications. attr_accessor :data_ref - # Contains array of publication objects, voucher object will be simplified. + # Response schema model for publishing vouchers to a specific customer. attr_accessor :publications # Total number of publications. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'publications', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::PublicationsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::PublicationsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'publications']).is_a?(Array) self.publications = value end - else - self.publications = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @publications.nil? - invalid_properties.push('invalid value for "publications", publications cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @publications.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/publications_list_response_body_publications_item.rb b/lib/VoucherifySdk/models/publications_list_response_body_publications_item.rb index 20934125..9704f631 100644 --- a/lib/VoucherifySdk/models/publications_list_response_body_publications_item.rb +++ b/lib/VoucherifySdk/models/publications_list_response_body_publications_item.rb @@ -14,94 +14,373 @@ require 'time' module VoucherifySdk - # Response schema model for publishing vouchers to a specific customer. - module PublicationsListResponseBodyPublicationsItem - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ListPublicationsItemInvalid', - :'ListPublicationsItemValidMultipleVouchers', - :'ListPublicationsItemValidSingleVoucher' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class PublicationsListResponseBodyPublicationsItem + # Unique publication ID, assigned by Voucherify. + attr_accessor :id + + # The type of the object represented by the JSON. This object stores information about the `publication`. + attr_accessor :object + + # Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Unique customer ID of the customer receiving the publication. + attr_accessor :customer_id + + # Customer's `source_id`. + attr_accessor :tracking_id + + attr_accessor :metadata + + # How the publication was originated. It can be your own custom channel or an example value provided here. + attr_accessor :channel + + # The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. + attr_accessor :source_id + + attr_accessor :customer + + # Contains the voucher IDs that was assigned by Voucherify. and Contains the unique voucher codes that was assigned by Voucherify. + attr_accessor :vouchers + + # Contains the unique internal voucher IDs that was assigned by Voucherify. + attr_accessor :vouchers_id + + attr_accessor :result + + attr_accessor :voucher + + # Generic reason as to why the create publication operation failed. + attr_accessor :failure_code + + # This parameter will provide more expanded reason as to why the create publication operation failed. + attr_accessor :failure_message + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'customer_id' => :'customer_id', + :'tracking_id' => :'tracking_id', + :'metadata' => :'metadata', + :'channel' => :'channel', + :'source_id' => :'source_id', + :'customer' => :'customer', + :'vouchers' => :'vouchers', + :'vouchers_id' => :'vouchers_id', + :'result' => :'result', + :'voucher' => :'voucher', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Time', + :'customer_id' => :'String', + :'tracking_id' => :'String', + :'metadata' => :'PublicationsListResponseBodyPublicationsItemMetadata', + :'channel' => :'String', + :'source_id' => :'String', + :'customer' => :'CustomerWithSummaryLoyaltyReferrals', + :'vouchers' => :'Array', + :'vouchers_id' => :'Array', + :'result' => :'String', + :'voucher' => :'ListPublicationsItemVoucher', + :'failure_code' => :'String', + :'failure_message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'created_at', + :'customer_id', + :'tracking_id', + :'channel', + :'source_id', + :'vouchers_id', + :'failure_code', + :'failure_message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'publication' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'vouchers') + if (value = attributes[:'vouchers']).is_a?(Array) + self.vouchers = value + end + end + + if attributes.key?(:'vouchers_id') + if (value = attributes[:'vouchers_id']).is_a?(Array) + self.vouchers_id = value + end + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["publication"]) + return false unless object_validator.valid?(@object) + result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) + return false unless result_validator.valid?(@result) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + customer_id == o.customer_id && + tracking_id == o.tracking_id && + metadata == o.metadata && + channel == o.channel && + source_id == o.source_id && + customer == o.customer && + vouchers == o.vouchers && + vouchers_id == o.vouchers_id && + result == o.result && + voucher == o.voucher && + failure_code == o.failure_code && + failure_message == o.failure_message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, customer_id, tracking_id, metadata, channel, source_id, customer, vouchers, vouchers_id, result, voucher, failure_code, failure_message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/publications_list_response_body_publications_item_metadata.rb b/lib/VoucherifySdk/models/publications_list_response_body_publications_item_metadata.rb new file mode 100644 index 00000000..eab07cc4 --- /dev/null +++ b/lib/VoucherifySdk/models/publications_list_response_body_publications_item_metadata.rb @@ -0,0 +1,231 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class PublicationsListResponseBodyPublicationsItemMetadata + # Defines the type of the distribution source. + attr_accessor :source_type + + # Unique identifier of the distribution source. + attr_accessor :source_id + + # Unique identifier of the distribution. + attr_accessor :distribution_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'source_type' => :'source_type', + :'source_id' => :'source_id', + :'distribution_id' => :'distribution_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'source_type' => :'String', + :'source_id' => :'String', + :'distribution_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'source_type', + :'source_id', + :'distribution_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'source_type') + self.source_type = attributes[:'source_type'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'distribution_id') + self.distribution_id = attributes[:'distribution_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + source_type == o.source_type && + source_id == o.source_id && + distribution_id == o.distribution_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [source_type, source_id, distribution_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/qualifications_check_eligibility_request_body.rb b/lib/VoucherifySdk/models/qualifications_check_eligibility_request_body.rb index 917dfe37..af9bc97a 100644 --- a/lib/VoucherifySdk/models/qualifications_check_eligibility_request_body.rb +++ b/lib/VoucherifySdk/models/qualifications_check_eligibility_request_body.rb @@ -14,19 +14,16 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/qualifications`. + # Request body schema for **POST** `v1/qualifications`. class QualificationsCheckEligibilityRequestBody attr_accessor :customer attr_accessor :order - # Defines which resources Voucherify will use. The `ADVANCED` mode is available after purchase only. - attr_accessor :mode - # Is correspondent to Customer's source_id attr_accessor :tracking_id - # Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). + # Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). attr_accessor :scenario attr_accessor :options @@ -61,7 +58,6 @@ def self.attribute_map { :'customer' => :'customer', :'order' => :'order', - :'mode' => :'mode', :'tracking_id' => :'tracking_id', :'scenario' => :'scenario', :'options' => :'options', @@ -79,7 +75,6 @@ def self.openapi_types { :'customer' => :'Customer', :'order' => :'Order', - :'mode' => :'String', :'tracking_id' => :'String', :'scenario' => :'String', :'options' => :'QualificationsOption', @@ -90,21 +85,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'tracking_id', + :'scenario', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsCheckEligibilityRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsCheckEligibilityRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -116,10 +107,6 @@ def initialize(attributes = {}) self.order = attributes[:'order'] end - if attributes.key?(:'mode') - self.mode = attributes[:'mode'] - end - if attributes.key?(:'tracking_id') self.tracking_id = attributes[:'tracking_id'] end @@ -149,33 +136,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - mode_validator = EnumAttributeValidator.new('String', ["BASIC", "ADVANCED"]) - return false unless mode_validator.valid?(@mode) scenario_validator = EnumAttributeValidator.new('String', ["ALL", "CUSTOMER_WALLET", "AUDIENCE_ONLY", "PRODUCTS", "PRODUCTS_DISCOUNT", "PROMOTION_STACKS", "PRODUCTS_BY_CUSTOMER", "PRODUCTS_DISCOUNT_BY_CUSTOMER"]) return false unless scenario_validator.valid?(@scenario) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] mode Object to be assigned - def mode=(mode) - validator = EnumAttributeValidator.new('String', ["BASIC", "ADVANCED"]) - unless validator.valid?(mode) - fail ArgumentError, "invalid value for \"mode\", must be one of #{validator.allowable_values}." - end - @mode = mode - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] scenario Object to be assigned - def scenario=(scenario) - validator = EnumAttributeValidator.new('String', ["ALL", "CUSTOMER_WALLET", "AUDIENCE_ONLY", "PRODUCTS", "PRODUCTS_DISCOUNT", "PROMOTION_STACKS", "PRODUCTS_BY_CUSTOMER", "PRODUCTS_DISCOUNT_BY_CUSTOMER"]) - unless validator.valid?(scenario) - fail ArgumentError, "invalid value for \"scenario\", must be one of #{validator.allowable_values}." - end - @scenario = scenario - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -183,7 +148,6 @@ def ==(o) self.class == o.class && customer == o.customer && order == o.order && - mode == o.mode && tracking_id == o.tracking_id && scenario == o.scenario && options == o.options && @@ -199,7 +163,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [customer, order, mode, tracking_id, scenario, options, metadata].hash + [customer, order, tracking_id, scenario, options, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/qualifications_check_eligibility_response_body.rb b/lib/VoucherifySdk/models/qualifications_check_eligibility_response_body.rb index 555244b0..cd21219b 100644 --- a/lib/VoucherifySdk/models/qualifications_check_eligibility_response_body.rb +++ b/lib/VoucherifySdk/models/qualifications_check_eligibility_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/qualifications`. + # Response body schema for **POST** `v1/qualifications`. class QualificationsCheckEligibilityResponseBody attr_accessor :redeemables @@ -53,21 +53,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'tracking_id', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsCheckEligibilityResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsCheckEligibilityResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/qualifications_field_conditions.rb b/lib/VoucherifySdk/models/qualifications_field_conditions.rb index 4e3634af..b8686d17 100644 --- a/lib/VoucherifySdk/models/qualifications_field_conditions.rb +++ b/lib/VoucherifySdk/models/qualifications_field_conditions.rb @@ -45,15 +45,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsFieldConditions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsFieldConditions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/qualifications_filters_condition.rb b/lib/VoucherifySdk/models/qualifications_filters_condition.rb index 48d05040..4c78e8fd 100644 --- a/lib/VoucherifySdk/models/qualifications_filters_condition.rb +++ b/lib/VoucherifySdk/models/qualifications_filters_condition.rb @@ -47,42 +47,45 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'is' => :'Any', - :'is_not' => :'Any', - :'has_value' => :'Any', - :'is_unknown' => :'Any', - :'_in' => :'Any', - :'not_in' => :'Any' + :'is' => :'Array', + :'is_not' => :'Array', + :'has_value' => :'Object', + :'is_unknown' => :'Object', + :'_in' => :'Array', + :'not_in' => :'Array' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'is', + :'is_not', + :'has_value', + :'is_unknown', + :'_in', + :'not_in' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsFiltersCondition` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsFiltersCondition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'is') - self.is = attributes[:'is'] + if (value = attributes[:'is']).is_a?(Array) + self.is = value + end end if attributes.key?(:'is_not') - self.is_not = attributes[:'is_not'] + if (value = attributes[:'is_not']).is_a?(Array) + self.is_not = value + end end if attributes.key?(:'has_value') @@ -94,11 +97,15 @@ def initialize(attributes = {}) end if attributes.key?(:'_in') - self._in = attributes[:'_in'] + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end end if attributes.key?(:'not_in') - self.not_in = attributes[:'not_in'] + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end end end diff --git a/lib/VoucherifySdk/models/qualifications_option.rb b/lib/VoucherifySdk/models/qualifications_option.rb index 9898d423..1cb79b43 100644 --- a/lib/VoucherifySdk/models/qualifications_option.rb +++ b/lib/VoucherifySdk/models/qualifications_option.rb @@ -82,22 +82,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'limit', :'starting_after', + :'filters', + :'expand', + :'sorting_rule' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsOption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsOption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -146,30 +143,6 @@ def valid? true end - # Custom attribute writer method with validation - # @param [Object] limit Value to be assigned - def limit=(limit) - if limit.nil? - fail ArgumentError, 'limit cannot be nil' - end - - if limit > 100 - fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 100.' - end - - @limit = limit - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] sorting_rule Object to be assigned - def sorting_rule=(sorting_rule) - validator = EnumAttributeValidator.new('String', ["BEST_DEAL", "LEAST_DEAL", "DEFAULT"]) - unless validator.valid?(sorting_rule) - fail ArgumentError, "invalid value for \"sorting_rule\", must be one of #{validator.allowable_values}." - end - @sorting_rule = sorting_rule - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/qualifications_option_filters.rb b/lib/VoucherifySdk/models/qualifications_option_filters.rb index 71e54e77..cb41f634 100644 --- a/lib/VoucherifySdk/models/qualifications_option_filters.rb +++ b/lib/VoucherifySdk/models/qualifications_option_filters.rb @@ -22,6 +22,8 @@ class QualificationsOptionFilters attr_accessor :campaign_id + attr_accessor :campaign_type + attr_accessor :resource_id attr_accessor :resource_type @@ -30,6 +32,8 @@ class QualificationsOptionFilters attr_accessor :code + attr_accessor :holder_role + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -58,10 +62,12 @@ def self.attribute_map :'junction' => :'junction', :'category_id' => :'category_id', :'campaign_id' => :'campaign_id', + :'campaign_type' => :'campaign_type', :'resource_id' => :'resource_id', :'resource_type' => :'resource_type', :'voucher_type' => :'voucher_type', - :'code' => :'code' + :'code' => :'code', + :'holder_role' => :'holder_role' } end @@ -76,31 +82,29 @@ def self.openapi_types :'junction' => :'Junction', :'category_id' => :'QualificationsFieldConditions', :'campaign_id' => :'QualificationsFieldConditions', + :'campaign_type' => :'QualificationsOptionFiltersCampaignType', :'resource_id' => :'QualificationsFieldConditions', :'resource_type' => :'QualificationsOptionFiltersResourceType', :'voucher_type' => :'QualificationsFieldConditions', - :'code' => :'QualificationsFieldConditions' + :'code' => :'QualificationsFieldConditions', + :'holder_role' => :'QualificationsOptionFiltersHolderRole' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'campaign_type', + :'resource_type', + :'holder_role' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsOptionFilters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsOptionFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -116,6 +120,10 @@ def initialize(attributes = {}) self.campaign_id = attributes[:'campaign_id'] end + if attributes.key?(:'campaign_type') + self.campaign_type = attributes[:'campaign_type'] + end + if attributes.key?(:'resource_id') self.resource_id = attributes[:'resource_id'] end @@ -131,6 +139,10 @@ def initialize(attributes = {}) if attributes.key?(:'code') self.code = attributes[:'code'] end + + if attributes.key?(:'holder_role') + self.holder_role = attributes[:'holder_role'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -156,10 +168,12 @@ def ==(o) junction == o.junction && category_id == o.category_id && campaign_id == o.campaign_id && + campaign_type == o.campaign_type && resource_id == o.resource_id && resource_type == o.resource_type && voucher_type == o.voucher_type && - code == o.code + code == o.code && + holder_role == o.holder_role end # @see the `==` method @@ -171,7 +185,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [junction, category_id, campaign_id, resource_id, resource_type, voucher_type, code].hash + [junction, category_id, campaign_id, campaign_type, resource_id, resource_type, voucher_type, code, holder_role].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/qualifications_option_filters_campaign_type.rb b/lib/VoucherifySdk/models/qualifications_option_filters_campaign_type.rb new file mode 100644 index 00000000..a1478a7c --- /dev/null +++ b/lib/VoucherifySdk/models/qualifications_option_filters_campaign_type.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Returns both campaigns and their vouchers or promotion tiers. Use other filters, e.g. `resource_type`, to narrow down the results. + class QualificationsOptionFiltersCampaignType + attr_accessor :conditions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'QualificationsOptionFiltersCampaignTypeConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/qualifications_option_filters_campaign_type_conditions.rb b/lib/VoucherifySdk/models/qualifications_option_filters_campaign_type_conditions.rb new file mode 100644 index 00000000..55c4c52f --- /dev/null +++ b/lib/VoucherifySdk/models/qualifications_option_filters_campaign_type_conditions.rb @@ -0,0 +1,247 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class QualificationsOptionFiltersCampaignTypeConditions + attr_accessor :is + + attr_accessor :is_not + + attr_accessor :_in + + attr_accessor :not_in + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'is' => :'$is', + :'is_not' => :'$is_not', + :'_in' => :'$in', + :'not_in' => :'$not_in' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'is' => :'Array', + :'is_not' => :'Array', + :'_in' => :'Array', + :'not_in' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'is', + :'is_not', + :'_in', + :'not_in' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'is') + if (value = attributes[:'is']).is_a?(Array) + self.is = value + end + end + + if attributes.key?(:'is_not') + if (value = attributes[:'is_not']).is_a?(Array) + self.is_not = value + end + end + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is == o.is && + is_not == o.is_not && + _in == o._in && + not_in == o.not_in + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [is, is_not, _in, not_in].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/qualifications_option_filters_holder_role.rb b/lib/VoucherifySdk/models/qualifications_option_filters_holder_role.rb new file mode 100644 index 00000000..36b0d49b --- /dev/null +++ b/lib/VoucherifySdk/models/qualifications_option_filters_holder_role.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class QualificationsOptionFiltersHolderRole + attr_accessor :conditions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'conditions' => :'QualificationsOptionFiltersHolderRoleConditions' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'conditions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'conditions') + self.conditions = attributes[:'conditions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [conditions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/qualifications_option_filters_holder_role_conditions.rb b/lib/VoucherifySdk/models/qualifications_option_filters_holder_role_conditions.rb new file mode 100644 index 00000000..e33e83a0 --- /dev/null +++ b/lib/VoucherifySdk/models/qualifications_option_filters_holder_role_conditions.rb @@ -0,0 +1,273 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Data filters used to narrow down the data records to be returned in the result. + class QualificationsOptionFiltersHolderRoleConditions + # Will return records only for the first value in the array. + attr_accessor :is + + # Will return records only for the first value in the array. + attr_accessor :is_not + + # Will return records for the values in the array. + attr_accessor :_in + + # Will return records for the values in the array. + attr_accessor :not_in + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'is' => :'$is', + :'is_not' => :'$is_not', + :'_in' => :'$in', + :'not_in' => :'$not_in' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'is' => :'Array', + :'is_not' => :'Array', + :'_in' => :'Array', + :'not_in' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'is', + :'is_not', + :'_in', + :'not_in' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'is') + if (value = attributes[:'is']).is_a?(Array) + self.is = value + end + end + + if attributes.key?(:'is_not') + if (value = attributes[:'is_not']).is_a?(Array) + self.is_not = value + end + end + + if attributes.key?(:'_in') + if (value = attributes[:'_in']).is_a?(Array) + self._in = value + end + end + + if attributes.key?(:'not_in') + if (value = attributes[:'not_in']).is_a?(Array) + self.not_in = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is == o.is && + is_not == o.is_not && + _in == o._in && + not_in == o.not_in + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [is, is_not, _in, not_in].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/qualifications_option_filters_resource_type.rb b/lib/VoucherifySdk/models/qualifications_option_filters_resource_type.rb index 5e84e3ad..3e8d814e 100644 --- a/lib/VoucherifySdk/models/qualifications_option_filters_resource_type.rb +++ b/lib/VoucherifySdk/models/qualifications_option_filters_resource_type.rb @@ -39,21 +39,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'conditions' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsOptionFiltersResourceType` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsOptionFiltersResourceType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/qualifications_option_filters_resource_type_conditions.rb b/lib/VoucherifySdk/models/qualifications_option_filters_resource_type_conditions.rb index dfe6d38c..d292cc3e 100644 --- a/lib/VoucherifySdk/models/qualifications_option_filters_resource_type_conditions.rb +++ b/lib/VoucherifySdk/models/qualifications_option_filters_resource_type_conditions.rb @@ -14,40 +14,16 @@ require 'time' module VoucherifySdk - # Data filters used to narrow the data records to be returned in the result. + # Data filters used to narrow down the data records to be returned in the result. class QualificationsOptionFiltersResourceTypeConditions attr_accessor :is attr_accessor :is_not - # Array of qualified redeemables. Accepts more than one value. Returns the resource types entered in the array. attr_accessor :_in - # Array of qualified redeemables. Accepts more than one value. Returns the resource types except those entered in the array. attr_accessor :not_in - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -66,8 +42,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'is' => :'ResourceTypes', - :'is_not' => :'ResourceTypes', + :'is' => :'Array', + :'is_not' => :'Array', :'_in' => :'Array', :'not_in' => :'Array' } @@ -76,30 +52,31 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'is', + :'is_not', + :'_in', + :'not_in' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsOptionFiltersResourceTypeConditions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsOptionFiltersResourceTypeConditions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'is') - self.is = attributes[:'is'] + if (value = attributes[:'is']).is_a?(Array) + self.is = value + end end if attributes.key?(:'is_not') - self.is_not = attributes[:'is_not'] + if (value = attributes[:'is_not']).is_a?(Array) + self.is_not = value + end end if attributes.key?(:'_in') diff --git a/lib/VoucherifySdk/models/qualifications_redeemable.rb b/lib/VoucherifySdk/models/qualifications_redeemable.rb index 31eafabf..e331b6cf 100644 --- a/lib/VoucherifySdk/models/qualifications_redeemable.rb +++ b/lib/VoucherifySdk/models/qualifications_redeemable.rb @@ -21,7 +21,7 @@ class QualificationsRedeemable # Object type of the redeemable. attr_accessor :object - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :created_at attr_accessor :result @@ -131,28 +131,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'created_at', + :'validation_rule_id', + :'metadata', + :'categories', + :'banner', + :'name', + :'campaign_name', + :'campaign_id', + :'redeemables' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'QualificationsRedeemableBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsRedeemable` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsRedeemable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -242,16 +239,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["campaign", "promotion_tier", "promotion_stack", "voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/qualifications_redeemable_base.rb b/lib/VoucherifySdk/models/qualifications_redeemable_base.rb index 938b84f6..e0d08ca6 100644 --- a/lib/VoucherifySdk/models/qualifications_redeemable_base.rb +++ b/lib/VoucherifySdk/models/qualifications_redeemable_base.rb @@ -22,7 +22,7 @@ class QualificationsRedeemableBase # Object type of the redeemable. attr_accessor :object - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :created_at attr_accessor :result @@ -128,21 +128,24 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'created_at', + :'validation_rule_id', + :'metadata', + :'categories', + :'banner', + :'name', + :'campaign_name', + :'campaign_id', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsRedeemableBase` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsRedeemableBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -226,16 +229,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["campaign", "promotion_tier", "promotion_stack", "voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/qualifications_redeemables.rb b/lib/VoucherifySdk/models/qualifications_redeemables.rb index 2c5c8791..93f82d2a 100644 --- a/lib/VoucherifySdk/models/qualifications_redeemables.rb +++ b/lib/VoucherifySdk/models/qualifications_redeemables.rb @@ -16,7 +16,7 @@ module VoucherifySdk # List of redeemables for examine qualification. class QualificationsRedeemables - # The type of object represented by JSON. Default is `list`. + # The type of the object represented by JSON. Default is `list`. attr_accessor :object # Identifies the name of the attribute that contains the array of qualified redeemables. @@ -28,10 +28,10 @@ class QualificationsRedeemables # The number of redeemables returned in the API request. attr_accessor :total - # As results are always limited, the `has_more` flag indicates whether there are more records for given parameters. This let's you know if you are able to run another request (with different options) to get more records returned in the results. + # As results are always limited, the `has_more` flag indicates if there are more records for given parameters. This lets you know if you can run another request (with different options) to get more records returned in the results. attr_accessor :has_more - # Timestamp representing the date and time to use in starting_after cursor to get more redeemables. + # Timestamp representing the date and time to use in `starting_after` cursor to get more redeemables. attr_accessor :more_starting_after class EnumAttributeValidator @@ -88,21 +88,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total', + :'has_more', + :'more_starting_after' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::QualificationsRedeemables` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::QualificationsRedeemables`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -122,20 +121,14 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'has_more') self.has_more = attributes[:'has_more'] - else - self.has_more = nil end if attributes.key?(:'more_starting_after') @@ -148,26 +141,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @has_more.nil? - invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') - end - invalid_properties end @@ -175,38 +148,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? - return false if @has_more.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/redeem_gift_card.rb b/lib/VoucherifySdk/models/redeem_gift_card.rb deleted file mode 100644 index 53a0cb58..00000000 --- a/lib/VoucherifySdk/models/redeem_gift_card.rb +++ /dev/null @@ -1,289 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedeemGiftCard - # Redeemable object type. - attr_accessor :object - - # Redeemable code. - attr_accessor :id - - attr_accessor :gift - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'id' => :'id', - :'gift' => :'gift' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'id' => :'String', - :'gift' => :'RedeemGiftCardAllOfGift' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RedeemVoucher' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemGiftCard` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemGiftCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'voucher' - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'gift') - self.gift = attributes[:'gift'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["voucher"]) - return false unless object_validator.valid?(@object) - return false if @id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - id == o.id && - gift == o.gift - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, id, gift].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeem_gift_card_all_of_gift.rb b/lib/VoucherifySdk/models/redeem_gift_card_all_of_gift.rb deleted file mode 100644 index 5ec78f0e..00000000 --- a/lib/VoucherifySdk/models/redeem_gift_card_all_of_gift.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains information on the number of gift card credits that the customer wants to apply to the order. - class RedeemGiftCardAllOfGift - # The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. - attr_accessor :credits - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'credits' => :'credits' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'credits' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemGiftCardAllOfGift` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemGiftCardAllOfGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'credits') - self.credits = attributes[:'credits'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - credits == o.credits - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [credits].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeem_loyalty_card.rb b/lib/VoucherifySdk/models/redeem_loyalty_card.rb deleted file mode 100644 index 56cf7c59..00000000 --- a/lib/VoucherifySdk/models/redeem_loyalty_card.rb +++ /dev/null @@ -1,289 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedeemLoyaltyCard - # Redeemable object type. - attr_accessor :object - - # Redeemable code. - attr_accessor :id - - attr_accessor :reward - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'id' => :'id', - :'reward' => :'reward' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'id' => :'String', - :'reward' => :'RedeemLoyaltyCardAllOfReward' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RedeemVoucher' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemLoyaltyCard` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'voucher' - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["voucher"]) - return false unless object_validator.valid?(@object) - return false if @id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - id == o.id && - reward == o.reward - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, id, reward].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeem_loyalty_card_all_of_reward.rb b/lib/VoucherifySdk/models/redeem_loyalty_card_all_of_reward.rb deleted file mode 100644 index fabe8d03..00000000 --- a/lib/VoucherifySdk/models/redeem_loyalty_card_all_of_reward.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. - class RedeemLoyaltyCardAllOfReward - # Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. - attr_accessor :id - - # The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemLoyaltyCardAllOfReward` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemLoyaltyCardAllOfReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeem_promotion_stack.rb b/lib/VoucherifySdk/models/redeem_promotion_stack.rb deleted file mode 100644 index a74e7e6a..00000000 --- a/lib/VoucherifySdk/models/redeem_promotion_stack.rb +++ /dev/null @@ -1,274 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Redeem a discount code. - class RedeemPromotionStack - # Redeemable object type. - attr_accessor :object - - # Promotion stack unique id, such as: stack_KxSD0GahLUg9ULB6TseGfUHJ - attr_accessor :id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemPromotionStack` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemPromotionStack`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'promotion_stack' - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["promotion_stack"]) - return false unless object_validator.valid?(@object) - return false if @id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["promotion_stack"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeem_promotion_tier.rb b/lib/VoucherifySdk/models/redeem_promotion_tier.rb deleted file mode 100644 index 9a5290fa..00000000 --- a/lib/VoucherifySdk/models/redeem_promotion_tier.rb +++ /dev/null @@ -1,274 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Redeem a discount code. - class RedeemPromotionTier - # Redeemable object type. - attr_accessor :object - - # Promotion tier unique id, such as: promo_Mwy9XpA0TLctSGriM5kum0qp - attr_accessor :id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemPromotionTier` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemPromotionTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'promotion_tier' - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["promotion_tier"]) - return false unless object_validator.valid?(@object) - return false if @id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["promotion_tier"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeem_voucher.rb b/lib/VoucherifySdk/models/redeem_voucher.rb deleted file mode 100644 index 010333cc..00000000 --- a/lib/VoucherifySdk/models/redeem_voucher.rb +++ /dev/null @@ -1,274 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Redeem a discount code. - class RedeemVoucher - # Redeemable object type. - attr_accessor :object - - # Redeemable code. - attr_accessor :id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'voucher' - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["voucher"]) - return false unless object_validator.valid?(@object) - return false if @id.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_gift.rb b/lib/VoucherifySdk/models/redeemable_gift.rb index a0450dab..995a8daa 100644 --- a/lib/VoucherifySdk/models/redeemable_gift.rb +++ b/lib/VoucherifySdk/models/redeemable_gift.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'balance', + :'credits' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableGift` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redeemable_loyalty_card.rb b/lib/VoucherifySdk/models/redeemable_loyalty_card.rb index 29dc9820..6b722140 100644 --- a/lib/VoucherifySdk/models/redeemable_loyalty_card.rb +++ b/lib/VoucherifySdk/models/redeemable_loyalty_card.rb @@ -16,7 +16,7 @@ module VoucherifySdk # Redeemable loyalty card object response class RedeemableLoyaltyCard - # Total points incurred over lifespan of loyalty card. + # Total points incurred over the lifespan of the loyalty card. attr_accessor :points # Points available for reward redemption. @@ -60,21 +60,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'balance', + :'exchange_ratio', + :'points_ratio', + :'transfers' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableLoyaltyCard` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redeemable_result.rb b/lib/VoucherifySdk/models/redeemable_result.rb index 53f8b5f3..37c4dd5d 100644 --- a/lib/VoucherifySdk/models/redeemable_result.rb +++ b/lib/VoucherifySdk/models/redeemable_result.rb @@ -58,15 +58,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResult` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redeemable_result_gift_card.rb b/lib/VoucherifySdk/models/redeemable_result_gift_card.rb deleted file mode 100644 index 0500b832..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_gift_card.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is a `result` object representing the results for a gift card. - class RedeemableResultGiftCard - attr_accessor :gift - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'gift' => :'gift' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'gift' => :'RedeemableResultGiftCardGift' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultGiftCard` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultGiftCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'gift') - self.gift = attributes[:'gift'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - gift == o.gift - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [gift].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_gift_card_gift.rb b/lib/VoucherifySdk/models/redeemable_result_gift_card_gift.rb deleted file mode 100644 index 29c28720..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_gift_card_gift.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Stores the amount of gift card credits to be applied in the redemption. - class RedeemableResultGiftCardGift - # Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). - attr_accessor :credits - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'credits' => :'credits' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'credits' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultGiftCardGift` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultGiftCardGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'credits') - self.credits = attributes[:'credits'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - credits == o.credits - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [credits].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_loyalty_card.rb b/lib/VoucherifySdk/models/redeemable_result_loyalty_card.rb deleted file mode 100644 index eb40972b..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_loyalty_card.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is a `result` object representing the results for a loyalty card. - class RedeemableResultLoyaltyCard - attr_accessor :loyalty_card - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'loyalty_card' => :'loyalty_card' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'loyalty_card' => :'RedeemableResultLoyaltyCardLoyaltyCard' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultLoyaltyCard` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'loyalty_card') - self.loyalty_card = attributes[:'loyalty_card'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - loyalty_card == o.loyalty_card - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [loyalty_card].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_loyalty_card_loyalty_card.rb b/lib/VoucherifySdk/models/redeemable_result_loyalty_card_loyalty_card.rb deleted file mode 100644 index bc392171..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_loyalty_card_loyalty_card.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Stores the amount of loyalty card points to be applied in the redemption. - class RedeemableResultLoyaltyCardLoyaltyCard - # Total number of loyalty points to be applied in the redemption. - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultLoyaltyCardLoyaltyCard` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultLoyaltyCardLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_promotion_stack.rb b/lib/VoucherifySdk/models/redeemable_result_promotion_stack.rb deleted file mode 100644 index 83d787b0..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_promotion_stack.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is a `result` object representing the results for a promotion stack. - class RedeemableResultPromotionStack - attr_accessor :loyalty_card - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'loyalty_card' => :'loyalty_card' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'loyalty_card' => :'RedeemableResultLoyaltyCardLoyaltyCard' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultPromotionStack` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultPromotionStack`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'loyalty_card') - self.loyalty_card = attributes[:'loyalty_card'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - loyalty_card == o.loyalty_card - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [loyalty_card].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_promotion_tier.rb b/lib/VoucherifySdk/models/redeemable_result_promotion_tier.rb deleted file mode 100644 index 3adb762d..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_promotion_tier.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is a `result` object representing the results for a promotion tier. - class RedeemableResultPromotionTier - attr_accessor :discount - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'discount' => :'discount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'discount' => :'RedeemableResultPromotionTierDiscount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultPromotionTier` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultPromotionTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - discount == o.discount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [discount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_promotion_tier_discount.rb b/lib/VoucherifySdk/models/redeemable_result_promotion_tier_discount.rb deleted file mode 100644 index edf45646..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_promotion_tier_discount.rb +++ /dev/null @@ -1,109 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Discount details about the type of discount to be applied for the redeemable. - module RedeemableResultPromotionTierDiscount - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'DiscountAmount', - :'DiscountFixed', - :'DiscountPercent', - :'DiscountUnit', - :'DiscountUnitMultiple' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_result_voucher_code.rb b/lib/VoucherifySdk/models/redeemable_result_voucher_code.rb deleted file mode 100644 index bdcc7452..00000000 --- a/lib/VoucherifySdk/models/redeemable_result_voucher_code.rb +++ /dev/null @@ -1,215 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is a `result` object representing the results for a coupon code. - class RedeemableResultVoucherCode - attr_accessor :discount - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'discount' => :'discount' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'discount' => :'RedeemableResultPromotionTierDiscount' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedeemableResultVoucherCode` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedeemableResultVoucherCode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - discount == o.discount - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [discount].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redeemable_voucher.rb b/lib/VoucherifySdk/models/redeemable_voucher.rb new file mode 100644 index 00000000..a9aefb52 --- /dev/null +++ b/lib/VoucherifySdk/models/redeemable_voucher.rb @@ -0,0 +1,524 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This is an object representing a voucher. + class RedeemableVoucher + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # The value is null. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Contains an empty array. + attr_accessor :categories + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'categories' => :'categories', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'referrer_id' => :'referrer_id', + :'holder_id' => :'holder_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'categories' => :'Array', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'RedeemableVoucherGift', + :'loyalty_card' => :'RedeemableVoucherLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'referrer_id' => :'String', + :'holder_id' => :'String', + :'object' => :'String', + :'publish' => :'RedeemableVoucherPublish', + :'redemption' => :'RedeemableVoucherRedemption' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'categories', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'referrer_id', + :'holder_id', + :'object', + :'publish', + :'redemption' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + categories == o.categories && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + referrer_id == o.referrer_id && + holder_id == o.holder_id && + object == o.object && + publish == o.publish && + redemption == o.redemption + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, referrer_id, holder_id, object, publish, redemption].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redeemable_voucher_gift.rb b/lib/VoucherifySdk/models/redeemable_voucher_gift.rb new file mode 100644 index 00000000..95063a53 --- /dev/null +++ b/lib/VoucherifySdk/models/redeemable_voucher_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class RedeemableVoucherGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redeemable_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/redeemable_voucher_loyalty_card.rb new file mode 100644 index 00000000..4a780123 --- /dev/null +++ b/lib/VoucherifySdk/models/redeemable_voucher_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class RedeemableVoucherLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redeemable_voucher_publish.rb b/lib/VoucherifySdk/models/redeemable_voucher_publish.rb new file mode 100644 index 00000000..5042bc60 --- /dev/null +++ b/lib/VoucherifySdk/models/redeemable_voucher_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + class RedeemableVoucherPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redeemable_voucher_redemption.rb b/lib/VoucherifySdk/models/redeemable_voucher_redemption.rb new file mode 100644 index 00000000..423b6551 --- /dev/null +++ b/lib/VoucherifySdk/models/redeemable_voucher_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class RedeemableVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption.rb b/lib/VoucherifySdk/models/redemption.rb index 2f756976..50518f9e 100644 --- a/lib/VoucherifySdk/models/redemption.rb +++ b/lib/VoucherifySdk/models/redemption.rb @@ -19,10 +19,10 @@ class Redemption # Unique redemption ID. attr_accessor :id - # The type of object represented by the JSON + # The type of the object represented by the JSON attr_accessor :object - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :date # Unique customer ID of the redeeming customer. @@ -34,7 +34,7 @@ class Redemption # The metadata object stores all custom attributes assigned to the redemption. attr_accessor :metadata - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. attr_accessor :amount # Unique redemption ID of the parent redemption. @@ -148,12 +148,12 @@ def self.openapi_types :'related_redemptions' => :'RedemptionRelatedRedemptions', :'failure_code' => :'String', :'failure_message' => :'String', - :'order' => :'OrderCalculatedNoCustomerData', + :'order' => :'OrderCalculated', :'channel' => :'RedemptionChannel', :'customer' => :'SimpleCustomer', :'related_object_type' => :'String', :'related_object_id' => :'String', - :'voucher' => :'Voucher', + :'voucher' => :'RedemptionVoucher', :'promotion_tier' => :'PromotionTier', :'reward' => :'RedemptionRewardResult', :'gift' => :'RedemptionGift', @@ -164,34 +164,38 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'date', :'customer_id', :'tracking_id', :'metadata', + :'amount', :'redemption', - :'order', - :'customer', + :'result', + :'status', + :'related_redemptions', + :'failure_code', + :'failure_message', + :'channel', + :'related_object_type', + :'related_object_id', + :'voucher', + :'gift', + :'loyalty_card' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Redemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Redemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -202,26 +206,18 @@ def initialize(attributes = {}) if attributes.key?(:'date') self.date = attributes[:'date'] - else - self.date = nil end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil end if attributes.key?(:'tracking_id') self.tracking_id = attributes[:'tracking_id'] - else - self.tracking_id = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'amount') @@ -230,20 +226,14 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] - else - self.redemption = nil end if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'status') self.status = attributes[:'status'] - else - self.status = nil end if attributes.key?(:'related_redemptions') @@ -260,32 +250,22 @@ def initialize(attributes = {}) if attributes.key?(:'order') self.order = attributes[:'order'] - else - self.order = nil end if attributes.key?(:'channel') self.channel = attributes[:'channel'] - else - self.channel = nil end if attributes.key?(:'customer') self.customer = attributes[:'customer'] - else - self.customer = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'voucher') @@ -314,38 +294,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @date.nil? - invalid_properties.push('invalid value for "date", date cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - invalid_properties end @@ -353,65 +301,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["redemption"]) return false unless object_validator.valid?(@object) - return false if @date.nil? - return false if @result.nil? result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) return false unless result_validator.valid?(@result) - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) return false unless status_validator.valid?(@status) - return false if @channel.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) return false unless related_object_type_validator.valid?(@related_object_type) - return false if @related_object_id.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["redemption"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/redemption_channel.rb b/lib/VoucherifySdk/models/redemption_channel.rb index 5b2dd502..443f02ce 100644 --- a/lib/VoucherifySdk/models/redemption_channel.rb +++ b/lib/VoucherifySdk/models/redemption_channel.rb @@ -68,21 +68,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'channel_id', + :'channel_type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionChannel` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionChannel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,16 +107,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel_type Object to be assigned - def channel_type=(channel_type) - validator = EnumAttributeValidator.new('String', ["USER", "API"]) - unless validator.valid?(channel_type) - fail ArgumentError, "invalid value for \"channel_type\", must be one of #{validator.allowable_values}." - end - @channel_type = channel_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/redemption_entry.rb b/lib/VoucherifySdk/models/redemption_entry.rb new file mode 100644 index 00000000..0f7f2a91 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry.rb @@ -0,0 +1,477 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntry + attr_accessor :id + + attr_accessor :object + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Unique customer ID of the redeeming customer. + attr_accessor :customer_id + + # Hashed customer source ID. + attr_accessor :tracking_id + + attr_accessor :metadata + + # For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + attr_accessor :amount + + # Unique redemption ID of the parent redemption. + attr_accessor :redemption + + # Redemption result. + attr_accessor :result + + attr_accessor :status + + attr_accessor :related_redemptions + + # If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + attr_accessor :failure_code + + # If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + attr_accessor :failure_message + + attr_accessor :order + + attr_accessor :channel + + attr_accessor :customer + + # Defines the related object. + attr_accessor :related_object_type + + attr_accessor :related_object_id + + attr_accessor :voucher + + attr_accessor :promotion_tier + + attr_accessor :reward + + attr_accessor :gift + + attr_accessor :loyalty_card + + # System generated cause for the redemption being invalid in the context of the provided parameters. + attr_accessor :reason + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'date' => :'date', + :'customer_id' => :'customer_id', + :'tracking_id' => :'tracking_id', + :'metadata' => :'metadata', + :'amount' => :'amount', + :'redemption' => :'redemption', + :'result' => :'result', + :'status' => :'status', + :'related_redemptions' => :'related_redemptions', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'order' => :'order', + :'channel' => :'channel', + :'customer' => :'customer', + :'related_object_type' => :'related_object_type', + :'related_object_id' => :'related_object_id', + :'voucher' => :'voucher', + :'promotion_tier' => :'promotion_tier', + :'reward' => :'reward', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'reason' => :'reason' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'date' => :'Time', + :'customer_id' => :'String', + :'tracking_id' => :'String', + :'metadata' => :'Object', + :'amount' => :'Integer', + :'redemption' => :'String', + :'result' => :'String', + :'status' => :'String', + :'related_redemptions' => :'RedemptionEntryRelatedRedemptions', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'order' => :'RedemptionEntryOrder', + :'channel' => :'RedemptionEntryChannel', + :'customer' => :'RedemptionEntryCustomer', + :'related_object_type' => :'String', + :'related_object_id' => :'String', + :'voucher' => :'RedemptionEntryVoucher', + :'promotion_tier' => :'RedemptionEntryPromotionTier', + :'reward' => :'RedemptionRewardResult', + :'gift' => :'RedemptionEntryGift', + :'loyalty_card' => :'RedemptionEntryLoyaltyCard', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'date', + :'customer_id', + :'tracking_id', + :'metadata', + :'amount', + :'redemption', + :'result', + :'status', + :'related_redemptions', + :'failure_code', + :'failure_message', + :'order', + :'channel', + :'customer', + :'related_object_type', + :'related_object_id', + :'voucher', + :'promotion_tier', + :'gift', + :'loyalty_card', + :'reason' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'related_redemptions') + self.related_redemptions = attributes[:'related_redemptions'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'related_object_type') + self.related_object_type = attributes[:'related_object_type'] + end + + if attributes.key?(:'related_object_id') + self.related_object_id = attributes[:'related_object_id'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'promotion_tier') + self.promotion_tier = attributes[:'promotion_tier'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["redemption", "redemption_rollback"]) + return false unless object_validator.valid?(@object) + result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) + return false unless result_validator.valid?(@result) + status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) + return false unless status_validator.valid?(@status) + related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) + return false unless related_object_type_validator.valid?(@related_object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + date == o.date && + customer_id == o.customer_id && + tracking_id == o.tracking_id && + metadata == o.metadata && + amount == o.amount && + redemption == o.redemption && + result == o.result && + status == o.status && + related_redemptions == o.related_redemptions && + failure_code == o.failure_code && + failure_message == o.failure_message && + order == o.order && + channel == o.channel && + customer == o.customer && + related_object_type == o.related_object_type && + related_object_id == o.related_object_id && + voucher == o.voucher && + promotion_tier == o.promotion_tier && + reward == o.reward && + gift == o.gift && + loyalty_card == o.loyalty_card && + reason == o.reason + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, date, customer_id, tracking_id, metadata, amount, redemption, result, status, related_redemptions, failure_code, failure_message, order, channel, customer, related_object_type, related_object_id, voucher, promotion_tier, reward, gift, loyalty_card, reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_channel.rb b/lib/VoucherifySdk/models/redemption_entry_channel.rb new file mode 100644 index 00000000..8f4a9c19 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_channel.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryChannel + attr_accessor :channel_id + + # The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + attr_accessor :channel_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_type' => :'channel_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'channel_id', + :'channel_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_type') + self.channel_type = attributes[:'channel_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) + return false unless channel_type_validator.valid?(@channel_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_type == o.channel_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [channel_id, channel_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_customer.rb b/lib/VoucherifySdk/models/redemption_entry_customer.rb new file mode 100644 index 00000000..ec6ec4ae --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_customer.rb @@ -0,0 +1,289 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryCustomer + # Unique identifier of an existing customer. It is assigned by Voucherify. + attr_accessor :id + + # Customer's first and last name. + attr_accessor :name + + # Customer's email address. + attr_accessor :email + + # A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + attr_accessor :source_id + + attr_accessor :metadata + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'email' => :'email', + :'source_id' => :'source_id', + :'metadata' => :'metadata', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'email' => :'String', + :'source_id' => :'String', + :'metadata' => :'Object', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'email', + :'source_id', + :'metadata', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + email == o.email && + source_id == o.source_id && + metadata == o.metadata && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, email, source_id, metadata, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_gift.rb b/lib/VoucherifySdk/models/redemption_entry_gift.rb new file mode 100644 index 00000000..adbc2a80 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_gift.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryGift + # Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_loyalty_card.rb b/lib/VoucherifySdk/models/redemption_entry_loyalty_card.rb new file mode 100644 index 00000000..d9433ddd --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_loyalty_card.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryLoyaltyCard + # Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_order.rb b/lib/VoucherifySdk/models/redemption_entry_order.rb new file mode 100644 index 00000000..80b63d89 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_order.rb @@ -0,0 +1,466 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryOrder + # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + attr_accessor :id + + # Unique source ID of an existing order that will be linked to the redemption of this request. + attr_accessor :source_id + + # The order status. + attr_accessor :status + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :amount + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :initial_amount + + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + + # Sum of all product-specific discounts applied to the order. + attr_accessor :items_discount_amount + + # Sum of all order-level AND all product-specific discounts applied to the order. + attr_accessor :total_discount_amount + + # Order amount after undoing all the discounts through the rollback redemption. + attr_accessor :total_amount + + # This field shows the order-level discount applied. + attr_accessor :applied_discount_amount + + # Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + attr_accessor :items_applied_discount_amount + + # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + attr_accessor :total_applied_discount_amount + + # Array of items applied to the order. + attr_accessor :items + + attr_accessor :metadata + + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer ID of the customer making the purchase. + attr_accessor :customer_id + + # Unique referrer ID. + attr_accessor :referrer_id + + attr_accessor :customer + + attr_accessor :referrer + + attr_accessor :redemptions + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'status' => :'status', + :'amount' => :'amount', + :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', + :'items_discount_amount' => :'items_discount_amount', + :'total_discount_amount' => :'total_discount_amount', + :'total_amount' => :'total_amount', + :'applied_discount_amount' => :'applied_discount_amount', + :'items_applied_discount_amount' => :'items_applied_discount_amount', + :'total_applied_discount_amount' => :'total_applied_discount_amount', + :'items' => :'items', + :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'customer_id' => :'customer_id', + :'referrer_id' => :'referrer_id', + :'customer' => :'customer', + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'status' => :'String', + :'amount' => :'Integer', + :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', + :'items_discount_amount' => :'Integer', + :'total_discount_amount' => :'Integer', + :'total_amount' => :'Integer', + :'applied_discount_amount' => :'Integer', + :'items_applied_discount_amount' => :'Integer', + :'total_applied_discount_amount' => :'Integer', + :'items' => :'Array', + :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'customer_id' => :'String', + :'referrer_id' => :'String', + :'customer' => :'RedemptionEntryOrderCustomer', + :'referrer' => :'RedemptionEntryOrderReferrer', + :'redemptions' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'metadata', + :'object', + :'created_at', + :'updated_at', + :'customer_id', + :'referrer_id', + :'customer', + :'referrer', + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'initial_amount') + self.initial_amount = attributes[:'initial_amount'] + end + + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + + if attributes.key?(:'items_discount_amount') + self.items_discount_amount = attributes[:'items_discount_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'applied_discount_amount') + self.applied_discount_amount = attributes[:'applied_discount_amount'] + end + + if attributes.key?(:'items_applied_discount_amount') + self.items_applied_discount_amount = attributes[:'items_applied_discount_amount'] + end + + if attributes.key?(:'total_applied_discount_amount') + self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] + end + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'order' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] + end + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) + return false unless status_validator.valid?(@status) + object_validator = EnumAttributeValidator.new('String', ["order"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + status == o.status && + amount == o.amount && + initial_amount == o.initial_amount && + discount_amount == o.discount_amount && + items_discount_amount == o.items_discount_amount && + total_discount_amount == o.total_discount_amount && + total_amount == o.total_amount && + applied_discount_amount == o.applied_discount_amount && + items_applied_discount_amount == o.items_applied_discount_amount && + total_applied_discount_amount == o.total_applied_discount_amount && + items == o.items && + metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && + customer_id == o.customer_id && + referrer_id == o.referrer_id && + customer == o.customer && + referrer == o.referrer && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_order_customer.rb b/lib/VoucherifySdk/models/redemption_entry_order_customer.rb new file mode 100644 index 00000000..502b5d42 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_order_customer.rb @@ -0,0 +1,246 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryOrderCustomer + # A unique identifier of an existing customer. + attr_accessor :id + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_order_referrer.rb b/lib/VoucherifySdk/models/redemption_entry_order_referrer.rb new file mode 100644 index 00000000..c5fdde25 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_order_referrer.rb @@ -0,0 +1,246 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryOrderReferrer + # A unique identifier of an existing customer. + attr_accessor :id + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_promotion_tier.rb b/lib/VoucherifySdk/models/redemption_entry_promotion_tier.rb new file mode 100644 index 00000000..ecbc6722 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_promotion_tier.rb @@ -0,0 +1,456 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryPromotionTier + # Unique promotion tier ID. + attr_accessor :id + + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # Promotion unique ID. + attr_accessor :promotion_id + + attr_accessor :campaign + + # Promotion tier's parent campaign's unique ID. + attr_accessor :campaign_id + + # A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + attr_accessor :active + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :summary + + # The type of the object represented by JSON. This object stores information about the promotion tier. + attr_accessor :object + + attr_accessor :validation_rule_assignments + + # Promotion tier category ID. + attr_accessor :category_id + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'promotion_id' => :'promotion_id', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'summary' => :'summary', + :'object' => :'object', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category_id' => :'category_id', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'name' => :'String', + :'banner' => :'String', + :'action' => :'RedemptionEntryPromotionTierAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'promotion_id' => :'String', + :'campaign' => :'RedemptionEntryPromotionTierCampaign', + :'campaign_id' => :'String', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'summary' => :'RedemptionEntryPromotionTierSummary', + :'object' => :'String', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category_id' => :'String', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'promotion_id') + self.promotion_id = attributes[:'promotion_id'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'promotion_tier' + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + updated_at == o.updated_at && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + promotion_id == o.promotion_id && + campaign == o.campaign && + campaign_id == o.campaign_id && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + summary == o.summary && + object == o.object && + validation_rule_assignments == o.validation_rule_assignments && + category_id == o.category_id && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_promotion_tier_action.rb b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_action.rb new file mode 100644 index 00000000..34391f10 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_action.rb @@ -0,0 +1,207 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryPromotionTierAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_promotion_tier_campaign.rb b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_campaign.rb new file mode 100644 index 00000000..a23c6d88 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_campaign.rb @@ -0,0 +1,318 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryPromotionTierCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary.rb b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary.rb new file mode 100644 index 00000000..b2a5b04b --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryPromotionTierSummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'RedemptionEntryPromotionTierSummaryRedemptions', + :'orders' => :'RedemptionEntryPromotionTierSummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary_orders.rb b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary_orders.rb new file mode 100644 index 00000000..3a418e09 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary_orders.rb @@ -0,0 +1,220 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryPromotionTierSummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary_redemptions.rb b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary_redemptions.rb new file mode 100644 index 00000000..6788d641 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_promotion_tier_summary_redemptions.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryPromotionTierSummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_related_redemptions.rb b/lib/VoucherifySdk/models/redemption_entry_related_redemptions.rb new file mode 100644 index 00000000..763bb2b2 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_related_redemptions.rb @@ -0,0 +1,222 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryRelatedRedemptions + attr_accessor :rollbacks + + attr_accessor :redemptions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rollbacks' => :'rollbacks', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rollbacks' => :'Array', + :'redemptions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'rollbacks', + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'rollbacks') + if (value = attributes[:'rollbacks']).is_a?(Array) + self.rollbacks = value + end + end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Array) + self.redemptions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rollbacks == o.rollbacks && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rollbacks, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/redemption_entry_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..430c0df4 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemption_entry_related_redemptions_rollbacks_item.rb new file mode 100644 index 00000000..bfa583af --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_related_redemptions_rollbacks_item.rb @@ -0,0 +1,217 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryRelatedRedemptionsRollbacksItem + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_voucher.rb b/lib/VoucherifySdk/models/redemption_entry_voucher.rb new file mode 100644 index 00000000..5dd2bd62 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_voucher.rb @@ -0,0 +1,540 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryVoucher + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + attr_accessor :holder + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'holder' => :'holder' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'RedemptionEntryVoucherGift', + :'loyalty_card' => :'RedemptionEntryVoucherLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'RedemptionEntryVoucherPublish', + :'redemption' => :'RedemptionEntryVoucherRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'holder' => :'SimpleCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'holder') + self.holder = attributes[:'holder'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments && + holder == o.holder + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments, holder].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_voucher_gift.rb b/lib/VoucherifySdk/models/redemption_entry_voucher_gift.rb new file mode 100644 index 00000000..84e1fe73 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_voucher_gift.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryVoucherGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/redemption_entry_voucher_loyalty_card.rb new file mode 100644 index 00000000..5449df97 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_voucher_loyalty_card.rb @@ -0,0 +1,242 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryVoucherLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_voucher_publish.rb b/lib/VoucherifySdk/models/redemption_entry_voucher_publish.rb new file mode 100644 index 00000000..3981712c --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_voucher_publish.rb @@ -0,0 +1,233 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryVoucherPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_entry_voucher_redemption.rb b/lib/VoucherifySdk/models/redemption_entry_voucher_redemption.rb new file mode 100644 index 00000000..4016ca86 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_entry_voucher_redemption.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionEntryVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_gift.rb b/lib/VoucherifySdk/models/redemption_gift.rb index 8aa5b9e1..64f4f79d 100644 --- a/lib/VoucherifySdk/models/redemption_gift.rb +++ b/lib/VoucherifySdk/models/redemption_gift.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Contains the amount being subtracted from the gift card for the redemption. + # Contains the amount subtracted from the gift card for the redemption. class RedemptionGift - # The amount subtracted from the gift card expressed as the smallest currency unit (e.g. 100 cents for $1.00). + # Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). attr_accessor :amount # Attribute mapping from ruby-style variable name to JSON key. @@ -41,21 +41,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'amount' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionGift` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_internal.rb b/lib/VoucherifySdk/models/redemption_internal.rb deleted file mode 100644 index 3db4e159..00000000 --- a/lib/VoucherifySdk/models/redemption_internal.rb +++ /dev/null @@ -1,542 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Model Used for internal communication - class RedemptionInternal - # Unique redemption ID. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the `redemption`. - attr_accessor :object - - # Timestamp representing the date and time when the redemption was created in ISO 8601 format. - attr_accessor :created_at - - # Hashed customer source ID. - attr_accessor :tracking_id - - # The metadata object stores all custom attributes assigned to the redemption. - attr_accessor :metadata - - # The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. - attr_accessor :channel_type - - # 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. - attr_accessor :channel_id - - # If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. - attr_accessor :failure_code - - # If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. - attr_accessor :failure_message - - attr_accessor :order - - attr_accessor :previous_order - - attr_accessor :reward - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :amount - - # System generated cause for the redemption being invalid in the context of the provided parameters. - attr_accessor :reason - - # Redemption result. - attr_accessor :result - - # Redemption status. - attr_accessor :status - - attr_accessor :related_redemptions - - # Unique redemption ID of the parent redemption. - attr_accessor :parent_redemption_id - - # Unique redemption ID of the parent redemption. - attr_accessor :redemption - - attr_accessor :customer - - # Unique customer ID of the redeeming customer. - attr_accessor :customer_id - - # Defines the related object. - attr_accessor :related_object_type - - # Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. - attr_accessor :related_object_id - - # Unique related parent object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. - attr_accessor :related_object_parent_id - - # Campaign name - attr_accessor :campaign_name - - attr_accessor :voucher - - attr_accessor :promotion_tier - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'channel_type' => :'channel_type', - :'channel_id' => :'channel_id', - :'failure_code' => :'failure_code', - :'failure_message' => :'failure_message', - :'order' => :'order', - :'previous_order' => :'previous_order', - :'reward' => :'reward', - :'amount' => :'amount', - :'reason' => :'reason', - :'result' => :'result', - :'status' => :'status', - :'related_redemptions' => :'related_redemptions', - :'parent_redemption_id' => :'parent_redemption_id', - :'redemption' => :'redemption', - :'customer' => :'customer', - :'customer_id' => :'customer_id', - :'related_object_type' => :'related_object_type', - :'related_object_id' => :'related_object_id', - :'related_object_parent_id' => :'related_object_parent_id', - :'campaign_name' => :'campaign_name', - :'voucher' => :'voucher', - :'promotion_tier' => :'promotion_tier' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'tracking_id' => :'String', - :'metadata' => :'Object', - :'channel_type' => :'String', - :'channel_id' => :'String', - :'failure_code' => :'String', - :'failure_message' => :'String', - :'order' => :'OrderCalculated', - :'previous_order' => :'OrderCalculated', - :'reward' => :'RedemptionRewardResult', - :'amount' => :'Integer', - :'reason' => :'String', - :'result' => :'String', - :'status' => :'String', - :'related_redemptions' => :'RedemptionInternalRelatedRedemptions', - :'parent_redemption_id' => :'String', - :'redemption' => :'String', - :'customer' => :'SimpleCustomer', - :'customer_id' => :'String', - :'related_object_type' => :'String', - :'related_object_id' => :'String', - :'related_object_parent_id' => :'String', - :'campaign_name' => :'String', - :'voucher' => :'Voucher', - :'promotion_tier' => :'PromotionTier' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'customer_id', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionInternal` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionInternal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'redemption' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'channel_type') - self.channel_type = attributes[:'channel_type'] - end - - if attributes.key?(:'channel_id') - self.channel_id = attributes[:'channel_id'] - end - - if attributes.key?(:'failure_code') - self.failure_code = attributes[:'failure_code'] - end - - if attributes.key?(:'failure_message') - self.failure_message = attributes[:'failure_message'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'previous_order') - self.previous_order = attributes[:'previous_order'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'reason') - self.reason = attributes[:'reason'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'related_redemptions') - self.related_redemptions = attributes[:'related_redemptions'] - end - - if attributes.key?(:'parent_redemption_id') - self.parent_redemption_id = attributes[:'parent_redemption_id'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - end - - if attributes.key?(:'related_object_type') - self.related_object_type = attributes[:'related_object_type'] - end - - if attributes.key?(:'related_object_id') - self.related_object_id = attributes[:'related_object_id'] - end - - if attributes.key?(:'related_object_parent_id') - self.related_object_parent_id = attributes[:'related_object_parent_id'] - end - - if attributes.key?(:'campaign_name') - self.campaign_name = attributes[:'campaign_name'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) - return false unless channel_type_validator.valid?(@channel_type) - result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - return false unless result_validator.valid?(@result) - status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED"]) - return false unless status_validator.valid?(@status) - related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) - return false unless related_object_type_validator.valid?(@related_object_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel_type Object to be assigned - def channel_type=(channel_type) - validator = EnumAttributeValidator.new('String', ["USER", "API"]) - unless validator.valid?(channel_type) - fail ArgumentError, "invalid value for \"channel_type\", must be one of #{validator.allowable_values}." - end - @channel_type = channel_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - tracking_id == o.tracking_id && - metadata == o.metadata && - channel_type == o.channel_type && - channel_id == o.channel_id && - failure_code == o.failure_code && - failure_message == o.failure_message && - order == o.order && - previous_order == o.previous_order && - reward == o.reward && - amount == o.amount && - reason == o.reason && - result == o.result && - status == o.status && - related_redemptions == o.related_redemptions && - parent_redemption_id == o.parent_redemption_id && - redemption == o.redemption && - customer == o.customer && - customer_id == o.customer_id && - related_object_type == o.related_object_type && - related_object_id == o.related_object_id && - related_object_parent_id == o.related_object_parent_id && - campaign_name == o.campaign_name && - voucher == o.voucher && - promotion_tier == o.promotion_tier - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, tracking_id, metadata, channel_type, channel_id, failure_code, failure_message, order, previous_order, reward, amount, reason, result, status, related_redemptions, parent_redemption_id, redemption, customer, customer_id, related_object_type, related_object_id, related_object_parent_id, campaign_name, voucher, promotion_tier].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_internal_related_redemptions.rb b/lib/VoucherifySdk/models/redemption_internal_related_redemptions.rb deleted file mode 100644 index 4f866beb..00000000 --- a/lib/VoucherifySdk/models/redemption_internal_related_redemptions.rb +++ /dev/null @@ -1,227 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedemptionInternalRelatedRedemptions - attr_accessor :rollbacks - - attr_accessor :redemptions - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'rollbacks' => :'rollbacks', - :'redemptions' => :'redemptions' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'rollbacks' => :'Array', - :'redemptions' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionInternalRelatedRedemptions` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionInternalRelatedRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'rollbacks') - if (value = attributes[:'rollbacks']).is_a?(Array) - self.rollbacks = value - end - end - - if attributes.key?(:'redemptions') - if (value = attributes[:'redemptions']).is_a?(Array) - self.redemptions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - rollbacks == o.rollbacks && - redemptions == o.redemptions - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [rollbacks, redemptions].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_internal_related_redemptions_item.rb b/lib/VoucherifySdk/models/redemption_internal_related_redemptions_item.rb deleted file mode 100644 index 2cae07ee..00000000 --- a/lib/VoucherifySdk/models/redemption_internal_related_redemptions_item.rb +++ /dev/null @@ -1,225 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedemptionInternalRelatedRedemptionsItem - # Unique redemption ID. - attr_accessor :id - - # Timestamp representing the date and time when the object was created in ISO 8601 format. - attr_accessor :date - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'date' => :'date' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'date' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionInternalRelatedRedemptionsItem` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionInternalRelatedRedemptionsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - date == o.date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_internal_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemption_internal_related_redemptions_rollbacks_item.rb deleted file mode 100644 index 8b65edc8..00000000 --- a/lib/VoucherifySdk/models/redemption_internal_related_redemptions_rollbacks_item.rb +++ /dev/null @@ -1,225 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedemptionInternalRelatedRedemptionsRollbacksItem - # Unique rollback redemption ID. - attr_accessor :id - - # Timestamp representing the date and time when the object was created in ISO 8601 format. - attr_accessor :date - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'date' => :'date' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'date' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionInternalRelatedRedemptionsRollbacksItem` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionInternalRelatedRedemptionsRollbacksItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - date == o.date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_loyalty_card.rb b/lib/VoucherifySdk/models/redemption_loyalty_card.rb index 3ec82ace..e64707cb 100644 --- a/lib/VoucherifySdk/models/redemption_loyalty_card.rb +++ b/lib/VoucherifySdk/models/redemption_loyalty_card.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Stores the number of points being added back to the loyalty card for the reward redemption rollback. + # Contains the number of points subtracted from the loyalty card for the redemption. class RedemptionLoyaltyCard - # Number of points being added back to the loyalty card for the reward redemption rollback. + # Number of points subtracted from the loyalty card as a result of the redemption. attr_accessor :points # Attribute mapping from ruby-style variable name to JSON key. @@ -41,21 +41,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionLoyaltyCard` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_related_redemptions.rb b/lib/VoucherifySdk/models/redemption_related_redemptions.rb index ae6c943e..0d9f4100 100644 --- a/lib/VoucherifySdk/models/redemption_related_redemptions.rb +++ b/lib/VoucherifySdk/models/redemption_related_redemptions.rb @@ -36,28 +36,23 @@ def self.acceptable_attributes def self.openapi_types { :'rollbacks' => :'Array', - :'redemptions' => :'Array' + :'redemptions' => :'Array' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'rollbacks', + :'redemptions' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRelatedRedemptions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRelatedRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_related_redemptions_item.rb b/lib/VoucherifySdk/models/redemption_related_redemptions_item.rb deleted file mode 100644 index 478cb311..00000000 --- a/lib/VoucherifySdk/models/redemption_related_redemptions_item.rb +++ /dev/null @@ -1,225 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedemptionRelatedRedemptionsItem - # Unique redemption ID. - attr_accessor :id - - # Timestamp representing the date and time when the object was created in ISO 8601 format. - attr_accessor :date - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'date' => :'date' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'date' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRelatedRedemptionsItem` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRelatedRedemptionsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - date == o.date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/redemption_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..165c7634 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemption_related_redemptions_rollbacks_item.rb index 5d8e845e..ee0b0948 100644 --- a/lib/VoucherifySdk/models/redemption_related_redemptions_rollbacks_item.rb +++ b/lib/VoucherifySdk/models/redemption_related_redemptions_rollbacks_item.rb @@ -18,7 +18,7 @@ class RedemptionRelatedRedemptionsRollbacksItem # Unique rollback redemption ID. attr_accessor :id - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :date # Attribute mapping from ruby-style variable name to JSON key. @@ -51,15 +51,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRelatedRedemptionsRollbacksItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRelatedRedemptionsRollbacksItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_reward_result.rb b/lib/VoucherifySdk/models/redemption_reward_result.rb index 0bb3fc45..08e7f21b 100644 --- a/lib/VoucherifySdk/models/redemption_reward_result.rb +++ b/lib/VoucherifySdk/models/redemption_reward_result.rb @@ -35,10 +35,10 @@ class RedemptionRewardResult # Name of the reward. attr_accessor :name - # The type of object represented by the JSON + # The type of the object represented by the JSON attr_accessor :object - # Timestamp representing the date and time when the redemption was created in ISO 8601 format. + # Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp in ISO 8601 format indicating when the reward was updated. @@ -46,6 +46,9 @@ class RedemptionRewardResult attr_accessor :parameters + # 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. + attr_accessor :metadata + # Reward type. attr_accessor :type @@ -86,6 +89,7 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'parameters' => :'parameters', + :'metadata' => :'metadata', :'type' => :'type' } end @@ -100,9 +104,9 @@ def self.openapi_types { :'customer' => :'SimpleCustomer', :'assignment_id' => :'String', - :'voucher' => :'RedemptionRewardResultVoucher', - :'product' => :'RedemptionRewardResultProduct', - :'sku' => :'RedemptionRewardResultSku', + :'voucher' => :'Voucher', + :'product' => :'Product', + :'sku' => :'Sku', :'loyalty_tier_id' => :'String', :'id' => :'String', :'name' => :'String', @@ -110,6 +114,7 @@ def self.openapi_types :'created_at' => :'Time', :'updated_at' => :'Time', :'parameters' => :'RedemptionRewardResultParameters', + :'metadata' => :'Object', :'type' => :'String' } end @@ -117,64 +122,49 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'customer', :'assignment_id', - :'voucher', - :'product', - :'sku', :'loyalty_tier_id', + :'id', + :'name', + :'object', + :'created_at', + :'updated_at', + :'parameters', + :'metadata', + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResult` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'customer') self.customer = attributes[:'customer'] - else - self.customer = nil end if attributes.key?(:'assignment_id') self.assignment_id = attributes[:'assignment_id'] - else - self.assignment_id = nil end if attributes.key?(:'voucher') self.voucher = attributes[:'voucher'] - else - self.voucher = nil end if attributes.key?(:'product') self.product = attributes[:'product'] - else - self.product = nil end if attributes.key?(:'sku') self.sku = attributes[:'sku'] - else - self.sku = nil end if attributes.key?(:'loyalty_tier_id') self.loyalty_tier_id = attributes[:'loyalty_tier_id'] - else - self.loyalty_tier_id = nil end if attributes.key?(:'id') @@ -203,6 +193,10 @@ def initialize(attributes = {}) self.parameters = attributes[:'parameters'] end + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -227,26 +221,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -264,6 +238,7 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && parameters == o.parameters && + metadata == o.metadata && type == o.type end @@ -276,7 +251,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [customer, assignment_id, voucher, product, sku, loyalty_tier_id, id, name, object, created_at, updated_at, parameters, type].hash + [customer, assignment_id, voucher, product, sku, loyalty_tier_id, id, name, object, created_at, updated_at, parameters, metadata, type].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/redemption_reward_result_parameters.rb b/lib/VoucherifySdk/models/redemption_reward_result_parameters.rb index 8e52161d..277fe9ff 100644 --- a/lib/VoucherifySdk/models/redemption_reward_result_parameters.rb +++ b/lib/VoucherifySdk/models/redemption_reward_result_parameters.rb @@ -48,21 +48,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'campaign', + :'product', + :'coin' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultParameters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_reward_result_parameters_campaign.rb b/lib/VoucherifySdk/models/redemption_reward_result_parameters_campaign.rb index e19e8aa0..2d6be152 100644 --- a/lib/VoucherifySdk/models/redemption_reward_result_parameters_campaign.rb +++ b/lib/VoucherifySdk/models/redemption_reward_result_parameters_campaign.rb @@ -51,21 +51,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'balance', + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultParametersCampaign` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultParametersCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_reward_result_parameters_coin.rb b/lib/VoucherifySdk/models/redemption_reward_result_parameters_coin.rb index 1da25d9a..8c987af8 100644 --- a/lib/VoucherifySdk/models/redemption_reward_result_parameters_coin.rb +++ b/lib/VoucherifySdk/models/redemption_reward_result_parameters_coin.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'exchange_ratio', + :'points_ratio' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultParametersCoin` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultParametersCoin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_reward_result_parameters_product.rb b/lib/VoucherifySdk/models/redemption_reward_result_parameters_product.rb index 062f7abd..2f1d07d8 100644 --- a/lib/VoucherifySdk/models/redemption_reward_result_parameters_product.rb +++ b/lib/VoucherifySdk/models/redemption_reward_result_parameters_product.rb @@ -19,7 +19,7 @@ class RedemptionRewardResultParametersProduct # Unique product ID, assigned by Voucherify. attr_accessor :id - # A unique SKU ID assigned by Voucherify. + # Unique identifier of the SKU. It is assigned by Voucherify. attr_accessor :sku_id # Attribute mapping from ruby-style variable name to JSON key. @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'sku_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultParametersProduct` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultParametersProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_reward_result_product.rb b/lib/VoucherifySdk/models/redemption_reward_result_product.rb deleted file mode 100644 index 04216b10..00000000 --- a/lib/VoucherifySdk/models/redemption_reward_result_product.rb +++ /dev/null @@ -1,397 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines of the product. - class RedemptionRewardResultProduct - # Unique product ID assigned by Voucherify. - attr_accessor :id - - # Unique product source ID. - attr_accessor :source_id - - # Unique user-defined product name. - attr_accessor :name - - # Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. - attr_accessor :price - - # A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. - attr_accessor :attributes - - # The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. - attr_accessor :metadata - - # The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. - attr_accessor :image_url - - # Timestamp representing the date and time when the product was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the product was updated in ISO 8601 format. - attr_accessor :updated_at - - # The type of object represented by JSON. This object stores information about the product. - attr_accessor :object - - attr_accessor :skus - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'name' => :'name', - :'price' => :'price', - :'attributes' => :'attributes', - :'metadata' => :'metadata', - :'image_url' => :'image_url', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'object' => :'object', - :'skus' => :'skus' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'name' => :'String', - :'price' => :'Integer', - :'attributes' => :'Array', - :'metadata' => :'Object', - :'image_url' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'object' => :'String', - :'skus' => :'SkusListForProduct' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - :'name', - :'price', - :'image_url', - :'updated_at', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Product' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultProduct` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - else - self.name = nil - end - - if attributes.key?(:'price') - self.price = attributes[:'price'] - else - self.price = nil - end - - if attributes.key?(:'attributes') - if (value = attributes[:'attributes']).is_a?(Array) - self.attributes = value - end - else - self.attributes = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'image_url') - self.image_url = attributes[:'image_url'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'product' - end - - if attributes.key?(:'skus') - self.skus = attributes[:'skus'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["product"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["product"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - name == o.name && - price == o.price && - attributes == o.attributes && - metadata == o.metadata && - image_url == o.image_url && - created_at == o.created_at && - updated_at == o.updated_at && - object == o.object && - skus == o.skus - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, name, price, attributes, metadata, image_url, created_at, updated_at, object, skus].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_reward_result_sku.rb b/lib/VoucherifySdk/models/redemption_reward_result_sku.rb deleted file mode 100644 index 61dc6622..00000000 --- a/lib/VoucherifySdk/models/redemption_reward_result_sku.rb +++ /dev/null @@ -1,425 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines of the sku. - class RedemptionRewardResultSku - # A unique identifier that represents the SKU and is assigned by Voucherify. - attr_accessor :id - - # A unique SKU identifier from your inventory system. - attr_accessor :source_id - - # The parent product's unique ID. - attr_accessor :product_id - - # Unique user-defined SKU name. - attr_accessor :sku - - # Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. - attr_accessor :price - - # SKU price currency. - attr_accessor :currency - - # The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. - attr_accessor :attributes - - # The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. - attr_accessor :image_url - - # The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. - attr_accessor :metadata - - # Timestamp representing the date and time when the SKU was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the SKU was updated in ISO 8601 format. - attr_accessor :updated_at - - # The type of object represented by JSON. This object stores information about the `SKU`. - attr_accessor :object - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'product_id' => :'product_id', - :'sku' => :'sku', - :'price' => :'price', - :'currency' => :'currency', - :'attributes' => :'attributes', - :'image_url' => :'image_url', - :'metadata' => :'metadata', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'object' => :'object' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'product_id' => :'String', - :'sku' => :'String', - :'price' => :'Integer', - :'currency' => :'String', - :'attributes' => :'Object', - :'image_url' => :'String', - :'metadata' => :'Object', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'object' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - :'sku', - :'price', - :'currency', - :'image_url', - :'updated_at', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Sku' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultSku` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultSku`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'product_id') - self.product_id = attributes[:'product_id'] - else - self.product_id = nil - end - - if attributes.key?(:'sku') - self.sku = attributes[:'sku'] - else - self.sku = nil - end - - if attributes.key?(:'price') - self.price = attributes[:'price'] - else - self.price = nil - end - - if attributes.key?(:'currency') - self.currency = attributes[:'currency'] - end - - if attributes.key?(:'attributes') - self.attributes = attributes[:'attributes'] - else - self.attributes = nil - end - - if attributes.key?(:'image_url') - self.image_url = attributes[:'image_url'] - else - self.image_url = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'sku' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @product_id.nil? - invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @product_id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @created_at.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["sku"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - product_id == o.product_id && - sku == o.sku && - price == o.price && - currency == o.currency && - attributes == o.attributes && - image_url == o.image_url && - metadata == o.metadata && - created_at == o.created_at && - updated_at == o.updated_at && - object == o.object - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, product_id, sku, price, currency, attributes, image_url, metadata, created_at, updated_at, object].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_reward_result_voucher.rb b/lib/VoucherifySdk/models/redemption_reward_result_voucher.rb deleted file mode 100644 index d814c29c..00000000 --- a/lib/VoucherifySdk/models/redemption_reward_result_voucher.rb +++ /dev/null @@ -1,547 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines of the voucher. - class RedemptionRewardResultVoucher - # Assigned by the Voucherify API, identifies the voucher. - attr_accessor :id - - # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. - attr_accessor :code - - # A unique campaign name, identifies the voucher's parent campaign. - attr_accessor :campaign - - # Assigned by the Voucherify API, identifies the voucher's parent campaign. - attr_accessor :campaign_id - - # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. - attr_accessor :category - - # Unique category ID assigned by Voucherify. - attr_accessor :category_id - - # Contains details about the category. - attr_accessor :categories - - # Defines the type of the voucher. - attr_accessor :type - - attr_accessor :discount - - attr_accessor :gift - - attr_accessor :loyalty_card - - # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. - attr_accessor :start_date - - # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. - attr_accessor :expiration_date - - attr_accessor :validity_timeframe - - # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday - attr_accessor :validity_day_of_week - - # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher - attr_accessor :active - - # An optional field to keep any extra textual information about the code such as a code description and details. - attr_accessor :additional_info - - # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. - attr_accessor :metadata - - attr_accessor :assets - - # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. - attr_accessor :is_referral_code - - # Timestamp representing the date and time when the voucher was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. - attr_accessor :updated_at - - # Unique customer ID of voucher owner. - attr_accessor :holder_id - - attr_accessor :holder - - # The type of object represented by JSON. Default is `voucher`. - attr_accessor :object - - attr_accessor :distributions - - # Flag indicating whether this voucher is deleted. - attr_accessor :deleted - - attr_accessor :validation_rules_assignments - - attr_accessor :publish - - attr_accessor :redemption - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'code' => :'code', - :'campaign' => :'campaign', - :'campaign_id' => :'campaign_id', - :'category' => :'category', - :'category_id' => :'category_id', - :'categories' => :'categories', - :'type' => :'type', - :'discount' => :'discount', - :'gift' => :'gift', - :'loyalty_card' => :'loyalty_card', - :'start_date' => :'start_date', - :'expiration_date' => :'expiration_date', - :'validity_timeframe' => :'validity_timeframe', - :'validity_day_of_week' => :'validity_day_of_week', - :'active' => :'active', - :'additional_info' => :'additional_info', - :'metadata' => :'metadata', - :'assets' => :'assets', - :'is_referral_code' => :'is_referral_code', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'holder_id' => :'holder_id', - :'holder' => :'holder', - :'object' => :'object', - :'distributions' => :'distributions', - :'deleted' => :'deleted', - :'validation_rules_assignments' => :'validation_rules_assignments', - :'publish' => :'publish', - :'redemption' => :'redemption' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'code' => :'String', - :'campaign' => :'String', - :'campaign_id' => :'String', - :'category' => :'String', - :'category_id' => :'String', - :'categories' => :'Array', - :'type' => :'String', - :'discount' => :'Discount', - :'gift' => :'VoucherGift', - :'loyalty_card' => :'VoucherLoyaltyCard', - :'start_date' => :'Time', - :'expiration_date' => :'Time', - :'validity_timeframe' => :'VoucherValidityTimeframe', - :'validity_day_of_week' => :'Array', - :'active' => :'Boolean', - :'additional_info' => :'String', - :'metadata' => :'Object', - :'assets' => :'VoucherAssets', - :'is_referral_code' => :'Boolean', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'holder_id' => :'String', - :'holder' => :'SimpleCustomer', - :'object' => :'String', - :'distributions' => :'Array', - :'deleted' => :'Boolean', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', - :'publish' => :'VoucherPublish', - :'redemption' => :'VoucherRedemption' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'active', - :'is_referral_code', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Voucher' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRewardResultVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRewardResultVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'code') - self.code = attributes[:'code'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - - if attributes.key?(:'campaign_id') - self.campaign_id = attributes[:'campaign_id'] - end - - if attributes.key?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - end - - if attributes.key?(:'gift') - self.gift = attributes[:'gift'] - end - - if attributes.key?(:'loyalty_card') - self.loyalty_card = attributes[:'loyalty_card'] - end - - if attributes.key?(:'start_date') - self.start_date = attributes[:'start_date'] - end - - if attributes.key?(:'expiration_date') - self.expiration_date = attributes[:'expiration_date'] - end - - if attributes.key?(:'validity_timeframe') - self.validity_timeframe = attributes[:'validity_timeframe'] - end - - if attributes.key?(:'validity_day_of_week') - if (value = attributes[:'validity_day_of_week']).is_a?(Array) - self.validity_day_of_week = value - end - end - - if attributes.key?(:'active') - self.active = attributes[:'active'] - end - - if attributes.key?(:'additional_info') - self.additional_info = attributes[:'additional_info'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'assets') - self.assets = attributes[:'assets'] - end - - if attributes.key?(:'is_referral_code') - self.is_referral_code = attributes[:'is_referral_code'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'holder_id') - self.holder_id = attributes[:'holder_id'] - end - - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'voucher' - end - - if attributes.key?(:'distributions') - if (value = attributes[:'distributions']).is_a?(Array) - self.distributions = value - end - end - - if attributes.key?(:'deleted') - self.deleted = attributes[:'deleted'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - - if attributes.key?(:'publish') - self.publish = attributes[:'publish'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - code == o.code && - campaign == o.campaign && - campaign_id == o.campaign_id && - category == o.category && - category_id == o.category_id && - categories == o.categories && - type == o.type && - discount == o.discount && - gift == o.gift && - loyalty_card == o.loyalty_card && - start_date == o.start_date && - expiration_date == o.expiration_date && - validity_timeframe == o.validity_timeframe && - validity_day_of_week == o.validity_day_of_week && - active == o.active && - additional_info == o.additional_info && - metadata == o.metadata && - assets == o.assets && - is_referral_code == o.is_referral_code && - created_at == o.created_at && - updated_at == o.updated_at && - holder_id == o.holder_id && - holder == o.holder && - object == o.object && - distributions == o.distributions && - deleted == o.deleted && - validation_rules_assignments == o.validation_rules_assignments && - publish == o.publish && - redemption == o.redemption - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, holder, object, distributions, deleted, validation_rules_assignments, publish, redemption].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_rollback.rb b/lib/VoucherifySdk/models/redemption_rollback.rb index 87103db2..a35ee022 100644 --- a/lib/VoucherifySdk/models/redemption_rollback.rb +++ b/lib/VoucherifySdk/models/redemption_rollback.rb @@ -16,13 +16,13 @@ module VoucherifySdk # This is an object representing a redemption rollback. class RedemptionRollback - # Unique redemption ID. + # Unique identifier of the redemption rollback. attr_accessor :id - # The type of object represented by the JSON + # The type of the object represented by the JSON attr_accessor :object - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :date # Unique customer ID of the redeeming customer. @@ -34,7 +34,7 @@ class RedemptionRollback # The metadata object stores all custom attributes assigned to the redemption. attr_accessor :metadata - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. attr_accessor :amount # Unique redemption ID of the parent redemption. @@ -66,7 +66,7 @@ class RedemptionRollback # Defines the related object. attr_accessor :related_object_type - # Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. + # Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. attr_accessor :related_object_id attr_accessor :voucher @@ -153,50 +153,54 @@ def self.openapi_types :'related_redemptions' => :'RedemptionRollbackRelatedRedemptions', :'failure_code' => :'String', :'failure_message' => :'String', - :'order' => :'OrderCalculatedNoCustomerData', - :'channel' => :'RedemptionChannel', + :'order' => :'OrderCalculated', + :'channel' => :'RedemptionRollbackChannel', :'customer' => :'SimpleCustomer', :'related_object_type' => :'String', :'related_object_id' => :'String', :'voucher' => :'Voucher', :'promotion_tier' => :'PromotionTier', :'reward' => :'RedemptionRewardResult', - :'gift' => :'RedemptionGift', - :'loyalty_card' => :'RedemptionLoyaltyCard' + :'gift' => :'RedemptionRollbackGift', + :'loyalty_card' => :'RedemptionRollbackLoyaltyCard' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'date', :'customer_id', :'tracking_id', :'metadata', + :'amount', :'redemption', - :'order', - :'customer', + :'reason', + :'result', + :'status', + :'related_redemptions', + :'failure_code', + :'failure_message', + :'channel', + :'related_object_type', + :'related_object_id', + :'gift', + :'loyalty_card' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRollback` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRollback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -207,26 +211,18 @@ def initialize(attributes = {}) if attributes.key?(:'date') self.date = attributes[:'date'] - else - self.date = nil end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil end if attributes.key?(:'tracking_id') self.tracking_id = attributes[:'tracking_id'] - else - self.tracking_id = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'amount') @@ -235,8 +231,6 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] - else - self.redemption = nil end if attributes.key?(:'reason') @@ -245,14 +239,10 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'status') self.status = attributes[:'status'] - else - self.status = nil end if attributes.key?(:'related_redemptions') @@ -269,32 +259,22 @@ def initialize(attributes = {}) if attributes.key?(:'order') self.order = attributes[:'order'] - else - self.order = nil end if attributes.key?(:'channel') self.channel = attributes[:'channel'] - else - self.channel = nil end if attributes.key?(:'customer') self.customer = attributes[:'customer'] - else - self.customer = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'voucher') @@ -323,38 +303,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @date.nil? - invalid_properties.push('invalid value for "date", date cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - invalid_properties end @@ -362,65 +310,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["redemption_rollback"]) return false unless object_validator.valid?(@object) - return false if @date.nil? - return false if @result.nil? result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) return false unless result_validator.valid?(@result) - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED"]) return false unless status_validator.valid?(@status) - return false if @channel.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) return false unless related_object_type_validator.valid?(@related_object_type) - return false if @related_object_id.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["redemption_rollback"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/redemption_rollback_channel.rb b/lib/VoucherifySdk/models/redemption_rollback_channel.rb new file mode 100644 index 00000000..49be8380 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_rollback_channel.rb @@ -0,0 +1,245 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the details of the channel through which the redemption was issued. + class RedemptionRollbackChannel + # Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. + attr_accessor :channel_id + + # The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + attr_accessor :channel_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_type' => :'channel_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'channel_id', + :'channel_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_type') + self.channel_type = attributes[:'channel_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) + return false unless channel_type_validator.valid?(@channel_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_type == o.channel_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [channel_id, channel_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_rollback_gift.rb b/lib/VoucherifySdk/models/redemption_rollback_gift.rb new file mode 100644 index 00000000..8d00d042 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_rollback_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the amount returned to the gift card in the redemption rollback. It is expressed as a negative integer. + class RedemptionRollbackGift + # Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_rollback_loyalty_card.rb b/lib/VoucherifySdk/models/redemption_rollback_loyalty_card.rb new file mode 100644 index 00000000..650dc86d --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_rollback_loyalty_card.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the number of points returned to the loyalty card in the reward redemption rollback. It is expressed as a negative integer. + class RedemptionRollbackLoyaltyCard + # Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions.rb b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions.rb index f0a87e75..01912003 100644 --- a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions.rb +++ b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions.rb @@ -36,28 +36,23 @@ def self.acceptable_attributes def self.openapi_types { :'rollbacks' => :'Array', - :'redemptions' => :'Array' + :'redemptions' => :'Array' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'rollbacks', + :'redemptions' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRollbackRelatedRedemptions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRollbackRelatedRedemptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_item.rb b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_item.rb deleted file mode 100644 index 5b8cd798..00000000 --- a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_item.rb +++ /dev/null @@ -1,225 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RedemptionRollbackRelatedRedemptionsItem - # Unique redemption ID. - attr_accessor :id - - # Timestamp representing the date and time when the object was created in ISO 8601 format. - attr_accessor :date - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'date' => :'date' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'date' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRollbackRelatedRedemptionsItem` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRollbackRelatedRedemptionsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - date == o.date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..e26c5db0 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionRollbackRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_rollbacks_item.rb index 7a39e30b..211627e9 100644 --- a/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_rollbacks_item.rb +++ b/lib/VoucherifySdk/models/redemption_rollback_related_redemptions_rollbacks_item.rb @@ -15,10 +15,10 @@ module VoucherifySdk class RedemptionRollbackRelatedRedemptionsRollbacksItem - # Unique rollback redemption ID. + # Unique identifier of the redemption rollback. attr_accessor :id - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :date # Attribute mapping from ruby-style variable name to JSON key. @@ -51,15 +51,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionRollbackRelatedRedemptionsRollbacksItem` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionRollbackRelatedRedemptionsRollbacksItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemption_voucher.rb b/lib/VoucherifySdk/models/redemption_voucher.rb new file mode 100644 index 00000000..8fe90737 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_voucher.rb @@ -0,0 +1,542 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the details of the voucher being redeemed. + class RedemptionVoucher + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + attr_accessor :holder + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'holder' => :'holder' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'RedemptionVoucherGift', + :'loyalty_card' => :'RedemptionVoucherLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'RedemptionVoucherPublish', + :'redemption' => :'RedemptionVoucherRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'holder' => :'SimpleCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'holder') + self.holder = attributes[:'holder'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments && + holder == o.holder + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments, holder].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_voucher_gift.rb b/lib/VoucherifySdk/models/redemption_voucher_gift.rb new file mode 100644 index 00000000..6c17d1a1 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_voucher_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class RedemptionVoucherGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/redemption_voucher_loyalty_card.rb new file mode 100644 index 00000000..ba0114ea --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_voucher_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class RedemptionVoucherLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_voucher_publish.rb b/lib/VoucherifySdk/models/redemption_voucher_publish.rb new file mode 100644 index 00000000..43faaacc --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_voucher_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class RedemptionVoucherPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemption_voucher_redemption.rb b/lib/VoucherifySdk/models/redemption_voucher_redemption.rb new file mode 100644 index 00000000..35ec4455 --- /dev/null +++ b/lib/VoucherifySdk/models/redemption_voucher_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class RedemptionVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body.rb b/lib/VoucherifySdk/models/redemptions_get_response_body.rb index 13f8fb83..b948736c 100644 --- a/lib/VoucherifySdk/models/redemptions_get_response_body.rb +++ b/lib/VoucherifySdk/models/redemptions_get_response_body.rb @@ -14,93 +14,464 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/redemptions/{redemptionId} - module RedemptionsGetResponseBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'Redemption', - :'RedemptionRollback' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class RedemptionsGetResponseBody + attr_accessor :id + + attr_accessor :object + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Unique customer ID of the redeeming customer. + attr_accessor :customer_id + + # Hashed customer source ID. + attr_accessor :tracking_id + + attr_accessor :metadata + + # For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + attr_accessor :amount + + # Unique redemption ID of the parent redemption. + attr_accessor :redemption + + # Redemption result. + attr_accessor :result + + attr_accessor :status + + attr_accessor :related_redemptions + + # If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + attr_accessor :failure_code + + # If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + attr_accessor :failure_message + + attr_accessor :order + + attr_accessor :channel + + attr_accessor :customer + + # Defines the related object. + attr_accessor :related_object_type + + attr_accessor :related_object_id + + attr_accessor :voucher + + attr_accessor :promotion_tier + + attr_accessor :reward + + attr_accessor :gift + + attr_accessor :loyalty_card + + # System generated cause for the redemption being invalid in the context of the provided parameters. + attr_accessor :reason + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'date' => :'date', + :'customer_id' => :'customer_id', + :'tracking_id' => :'tracking_id', + :'metadata' => :'metadata', + :'amount' => :'amount', + :'redemption' => :'redemption', + :'result' => :'result', + :'status' => :'status', + :'related_redemptions' => :'related_redemptions', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'order' => :'order', + :'channel' => :'channel', + :'customer' => :'customer', + :'related_object_type' => :'related_object_type', + :'related_object_id' => :'related_object_id', + :'voucher' => :'voucher', + :'promotion_tier' => :'promotion_tier', + :'reward' => :'reward', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'reason' => :'reason' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'date' => :'Time', + :'customer_id' => :'String', + :'tracking_id' => :'String', + :'metadata' => :'Object', + :'amount' => :'Integer', + :'redemption' => :'String', + :'result' => :'String', + :'status' => :'String', + :'related_redemptions' => :'RedemptionsGetResponseBodyRelatedRedemptions', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'order' => :'RedemptionsGetResponseBodyOrder', + :'channel' => :'RedemptionsGetResponseBodyChannel', + :'customer' => :'RedemptionsGetResponseBodyCustomer', + :'related_object_type' => :'String', + :'related_object_id' => :'String', + :'voucher' => :'RedemptionsGetResponseBodyVoucher', + :'promotion_tier' => :'RedemptionsGetResponseBodyPromotionTier', + :'reward' => :'RedemptionRewardResult', + :'gift' => :'RedemptionsGetResponseBodyGift', + :'loyalty_card' => :'RedemptionsGetResponseBodyLoyaltyCard', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'date', + :'customer_id', + :'tracking_id', + :'metadata', + :'amount', + :'redemption', + :'result', + :'status', + :'related_redemptions', + :'failure_code', + :'failure_message', + :'order', + :'channel', + :'customer', + :'related_object_type', + :'related_object_id', + :'voucher', + :'promotion_tier', + :'gift', + :'loyalty_card', + :'reason' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'related_redemptions') + self.related_redemptions = attributes[:'related_redemptions'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'related_object_type') + self.related_object_type = attributes[:'related_object_type'] + end + + if attributes.key?(:'related_object_id') + self.related_object_id = attributes[:'related_object_id'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'promotion_tier') + self.promotion_tier = attributes[:'promotion_tier'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["redemption", "redemption_rollback"]) + return false unless object_validator.valid?(@object) + result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) + return false unless result_validator.valid?(@result) + status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) + return false unless status_validator.valid?(@status) + related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) + return false unless related_object_type_validator.valid?(@related_object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + date == o.date && + customer_id == o.customer_id && + tracking_id == o.tracking_id && + metadata == o.metadata && + amount == o.amount && + redemption == o.redemption && + result == o.result && + status == o.status && + related_redemptions == o.related_redemptions && + failure_code == o.failure_code && + failure_message == o.failure_message && + order == o.order && + channel == o.channel && + customer == o.customer && + related_object_type == o.related_object_type && + related_object_id == o.related_object_id && + voucher == o.voucher && + promotion_tier == o.promotion_tier && + reward == o.reward && + gift == o.gift && + loyalty_card == o.loyalty_card && + reason == o.reason + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, date, customer_id, tracking_id, metadata, amount, redemption, result, status, related_redemptions, failure_code, failure_message, order, channel, customer, related_object_type, related_object_id, voucher, promotion_tier, reward, gift, loyalty_card, reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_channel.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_channel.rb new file mode 100644 index 00000000..a7d4ed23 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_channel.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyChannel + attr_accessor :channel_id + + # The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + attr_accessor :channel_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_type' => :'channel_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'channel_id', + :'channel_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_type') + self.channel_type = attributes[:'channel_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) + return false unless channel_type_validator.valid?(@channel_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_type == o.channel_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [channel_id, channel_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_customer.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_customer.rb new file mode 100644 index 00000000..f2282ede --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_customer.rb @@ -0,0 +1,289 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyCustomer + # Unique identifier of an existing customer. It is assigned by Voucherify. + attr_accessor :id + + # Customer's first and last name. + attr_accessor :name + + # Customer's email address. + attr_accessor :email + + # A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + attr_accessor :source_id + + attr_accessor :metadata + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'email' => :'email', + :'source_id' => :'source_id', + :'metadata' => :'metadata', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'email' => :'String', + :'source_id' => :'String', + :'metadata' => :'Object', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'email', + :'source_id', + :'metadata', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + email == o.email && + source_id == o.source_id && + metadata == o.metadata && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, email, source_id, metadata, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_gift.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_gift.rb new file mode 100644 index 00000000..e4026576 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_gift.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyGift + # Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_loyalty_card.rb new file mode 100644 index 00000000..530bd688 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_loyalty_card.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyLoyaltyCard + # Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb new file mode 100644 index 00000000..2449c8cd --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb @@ -0,0 +1,466 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyOrder + # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + attr_accessor :id + + # Unique source ID of an existing order that will be linked to the redemption of this request. + attr_accessor :source_id + + # The order status. + attr_accessor :status + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :amount + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :initial_amount + + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + + # Sum of all product-specific discounts applied to the order. + attr_accessor :items_discount_amount + + # Sum of all order-level AND all product-specific discounts applied to the order. + attr_accessor :total_discount_amount + + # Order amount after undoing all the discounts through the rollback redemption. + attr_accessor :total_amount + + # This field shows the order-level discount applied. + attr_accessor :applied_discount_amount + + # Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + attr_accessor :items_applied_discount_amount + + # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + attr_accessor :total_applied_discount_amount + + # Array of items applied to the order. + attr_accessor :items + + attr_accessor :metadata + + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer ID of the customer making the purchase. + attr_accessor :customer_id + + # Unique referrer ID. + attr_accessor :referrer_id + + attr_accessor :customer + + attr_accessor :referrer + + attr_accessor :redemptions + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'status' => :'status', + :'amount' => :'amount', + :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', + :'items_discount_amount' => :'items_discount_amount', + :'total_discount_amount' => :'total_discount_amount', + :'total_amount' => :'total_amount', + :'applied_discount_amount' => :'applied_discount_amount', + :'items_applied_discount_amount' => :'items_applied_discount_amount', + :'total_applied_discount_amount' => :'total_applied_discount_amount', + :'items' => :'items', + :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'customer_id' => :'customer_id', + :'referrer_id' => :'referrer_id', + :'customer' => :'customer', + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'status' => :'String', + :'amount' => :'Integer', + :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', + :'items_discount_amount' => :'Integer', + :'total_discount_amount' => :'Integer', + :'total_amount' => :'Integer', + :'applied_discount_amount' => :'Integer', + :'items_applied_discount_amount' => :'Integer', + :'total_applied_discount_amount' => :'Integer', + :'items' => :'Array', + :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'customer_id' => :'String', + :'referrer_id' => :'String', + :'customer' => :'RedemptionsGetResponseBodyOrderCustomer', + :'referrer' => :'RedemptionsGetResponseBodyOrderReferrer', + :'redemptions' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'metadata', + :'object', + :'created_at', + :'updated_at', + :'customer_id', + :'referrer_id', + :'customer', + :'referrer', + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'initial_amount') + self.initial_amount = attributes[:'initial_amount'] + end + + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + + if attributes.key?(:'items_discount_amount') + self.items_discount_amount = attributes[:'items_discount_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'applied_discount_amount') + self.applied_discount_amount = attributes[:'applied_discount_amount'] + end + + if attributes.key?(:'items_applied_discount_amount') + self.items_applied_discount_amount = attributes[:'items_applied_discount_amount'] + end + + if attributes.key?(:'total_applied_discount_amount') + self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] + end + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'order' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] + end + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) + return false unless status_validator.valid?(@status) + object_validator = EnumAttributeValidator.new('String', ["order"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + status == o.status && + amount == o.amount && + initial_amount == o.initial_amount && + discount_amount == o.discount_amount && + items_discount_amount == o.items_discount_amount && + total_discount_amount == o.total_discount_amount && + total_amount == o.total_amount && + applied_discount_amount == o.applied_discount_amount && + items_applied_discount_amount == o.items_applied_discount_amount && + total_applied_discount_amount == o.total_applied_discount_amount && + items == o.items && + metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && + customer_id == o.customer_id && + referrer_id == o.referrer_id && + customer == o.customer && + referrer == o.referrer && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_order_customer.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_order_customer.rb new file mode 100644 index 00000000..c27cb1c8 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_order_customer.rb @@ -0,0 +1,246 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyOrderCustomer + # A unique identifier of an existing customer. + attr_accessor :id + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_order_referrer.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_order_referrer.rb new file mode 100644 index 00000000..047888f1 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_order_referrer.rb @@ -0,0 +1,246 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyOrderReferrer + # A unique identifier of an existing customer. + attr_accessor :id + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier.rb new file mode 100644 index 00000000..3762c005 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier.rb @@ -0,0 +1,456 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyPromotionTier + # Unique promotion tier ID. + attr_accessor :id + + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # Promotion unique ID. + attr_accessor :promotion_id + + attr_accessor :campaign + + # Promotion tier's parent campaign's unique ID. + attr_accessor :campaign_id + + # A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + attr_accessor :active + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :summary + + # The type of the object represented by JSON. This object stores information about the promotion tier. + attr_accessor :object + + attr_accessor :validation_rule_assignments + + # Promotion tier category ID. + attr_accessor :category_id + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'promotion_id' => :'promotion_id', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'summary' => :'summary', + :'object' => :'object', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category_id' => :'category_id', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'name' => :'String', + :'banner' => :'String', + :'action' => :'RedemptionsGetResponseBodyPromotionTierAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'promotion_id' => :'String', + :'campaign' => :'RedemptionsGetResponseBodyPromotionTierCampaign', + :'campaign_id' => :'String', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'summary' => :'RedemptionsGetResponseBodyPromotionTierSummary', + :'object' => :'String', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category_id' => :'String', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'action', + :'metadata', + :'hierarchy', + :'promotion_id', + :'campaign', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'summary', + :'object', + :'category_id', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'promotion_id') + self.promotion_id = attributes[:'promotion_id'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'promotion_tier' + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + updated_at == o.updated_at && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + promotion_id == o.promotion_id && + campaign == o.campaign && + campaign_id == o.campaign_id && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + summary == o.summary && + object == o.object && + validation_rule_assignments == o.validation_rule_assignments && + category_id == o.category_id && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_action.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_action.rb new file mode 100644 index 00000000..60f6dc77 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_action.rb @@ -0,0 +1,207 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyPromotionTierAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_campaign.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_campaign.rb new file mode 100644 index 00000000..3685e32f --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_campaign.rb @@ -0,0 +1,318 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyPromotionTierCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary.rb new file mode 100644 index 00000000..7eea75c4 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyPromotionTierSummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'RedemptionsGetResponseBodyPromotionTierSummaryRedemptions', + :'orders' => :'RedemptionsGetResponseBodyPromotionTierSummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions', + :'orders' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_orders.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_orders.rb new file mode 100644 index 00000000..65f72b80 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_orders.rb @@ -0,0 +1,220 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyPromotionTierSummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_redemptions.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_redemptions.rb new file mode 100644 index 00000000..726ad408 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_promotion_tier_summary_redemptions.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyPromotionTierSummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions.rb new file mode 100644 index 00000000..a69b082c --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions.rb @@ -0,0 +1,222 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyRelatedRedemptions + attr_accessor :rollbacks + + attr_accessor :redemptions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rollbacks' => :'rollbacks', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rollbacks' => :'Array', + :'redemptions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'rollbacks', + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'rollbacks') + if (value = attributes[:'rollbacks']).is_a?(Array) + self.rollbacks = value + end + end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Array) + self.redemptions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rollbacks == o.rollbacks && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rollbacks, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..bcca55e9 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions_rollbacks_item.rb new file mode 100644 index 00000000..7894b45c --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_related_redemptions_rollbacks_item.rb @@ -0,0 +1,217 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_voucher.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher.rb new file mode 100644 index 00000000..9f939597 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher.rb @@ -0,0 +1,540 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyVoucher + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + attr_accessor :holder + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'holder' => :'holder' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'RedemptionsGetResponseBodyVoucherGift', + :'loyalty_card' => :'RedemptionsGetResponseBodyVoucherLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'RedemptionsGetResponseBodyVoucherPublish', + :'redemption' => :'RedemptionsGetResponseBodyVoucherRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'holder' => :'SimpleCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'holder') + self.holder = attributes[:'holder'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments && + holder == o.holder + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments, holder].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_gift.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_gift.rb new file mode 100644 index 00000000..66c484a9 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_gift.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyVoucherGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_loyalty_card.rb new file mode 100644 index 00000000..ac8e6d38 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_loyalty_card.rb @@ -0,0 +1,242 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyVoucherLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_publish.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_publish.rb new file mode 100644 index 00000000..2fb51f16 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_publish.rb @@ -0,0 +1,233 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyVoucherPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_redemption.rb b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_redemption.rb new file mode 100644 index 00000000..1480acba --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_redemption.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsGetResponseBodyVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body.rb b/lib/VoucherifySdk/models/redemptions_list_response_body.rb index 16fb7191..776773aa 100644 --- a/lib/VoucherifySdk/models/redemptions_list_response_body.rb +++ b/lib/VoucherifySdk/models/redemptions_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/redemptions`. + # Response body schema for **GET** `v1/redemptions`. class RedemptionsListResponseBody - # The type of object represented by JSON. This object stores information about redemptions in a dictionary. + # The type of the object represented by JSON. This object stores information about redemptions in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of redemption objects. @@ -55,21 +55,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'redemptions', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -89,14 +86,10 @@ def initialize(attributes = {}) if (value = attributes[:'redemptions']).is_a?(Array) self.redemptions = value end - else - self.redemptions = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -105,22 +98,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @redemptions.nil? - invalid_properties.push('invalid value for "redemptions", redemptions cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -128,10 +105,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @redemptions.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item.rb index d9270075..b5b65a2f 100644 --- a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item.rb +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item.rb @@ -14,92 +14,450 @@ require 'time' module VoucherifySdk - module RedemptionsListResponseBodyRedemptionsItem - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'Redemption', - :'RedemptionRollback' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises + class RedemptionsListResponseBodyRedemptionsItem + attr_accessor :id + + attr_accessor :object + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Unique customer ID of the redeeming customer. + attr_accessor :customer_id + + # Hashed customer source ID. + attr_accessor :tracking_id + + attr_accessor :metadata + + # For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + attr_accessor :amount + + # Unique redemption ID of the parent redemption. + attr_accessor :redemption + + # Redemption result. + attr_accessor :result + + attr_accessor :status + + attr_accessor :related_redemptions + + # If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + attr_accessor :failure_code + + # If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + attr_accessor :failure_message + + attr_accessor :order + + attr_accessor :channel + + attr_accessor :customer + + # Defines the related object. + attr_accessor :related_object_type + + attr_accessor :related_object_id + + attr_accessor :voucher + + attr_accessor :promotion_tier + + attr_accessor :reward + + attr_accessor :gift + + attr_accessor :loyalty_card + + # System generated cause for the redemption being invalid in the context of the provided parameters. + attr_accessor :reason + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value end end + end - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'date' => :'date', + :'customer_id' => :'customer_id', + :'tracking_id' => :'tracking_id', + :'metadata' => :'metadata', + :'amount' => :'amount', + :'redemption' => :'redemption', + :'result' => :'result', + :'status' => :'status', + :'related_redemptions' => :'related_redemptions', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'order' => :'order', + :'channel' => :'channel', + :'customer' => :'customer', + :'related_object_type' => :'related_object_type', + :'related_object_id' => :'related_object_id', + :'voucher' => :'voucher', + :'promotion_tier' => :'promotion_tier', + :'reward' => :'reward', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'reason' => :'reason' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'date' => :'Time', + :'customer_id' => :'String', + :'tracking_id' => :'String', + :'metadata' => :'Object', + :'amount' => :'Integer', + :'redemption' => :'String', + :'result' => :'String', + :'status' => :'String', + :'related_redemptions' => :'RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'order' => :'RedemptionsListResponseBodyRedemptionsItemOrder', + :'channel' => :'RedemptionsListResponseBodyRedemptionsItemChannel', + :'customer' => :'RedemptionsListResponseBodyRedemptionsItemCustomer', + :'related_object_type' => :'String', + :'related_object_id' => :'String', + :'voucher' => :'RedemptionsListResponseBodyRedemptionsItemVoucher', + :'promotion_tier' => :'RedemptionsListResponseBodyRedemptionsItemPromotionTier', + :'reward' => :'RedemptionRewardResult', + :'gift' => :'RedemptionsListResponseBodyRedemptionsItemGift', + :'loyalty_card' => :'RedemptionsListResponseBodyRedemptionsItemLoyaltyCard', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'date', + :'customer_id', + :'tracking_id', + :'redemption', + :'result', + :'failure_code', + :'failure_message', + :'related_object_type', + :'reason' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'related_redemptions') + self.related_redemptions = attributes[:'related_redemptions'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'related_object_type') + self.related_object_type = attributes[:'related_object_type'] + end + + if attributes.key?(:'related_object_id') + self.related_object_id = attributes[:'related_object_id'] + end + + if attributes.key?(:'voucher') + self.voucher = attributes[:'voucher'] + end + + if attributes.key?(:'promotion_tier') + self.promotion_tier = attributes[:'promotion_tier'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["redemption", "redemption_rollback"]) + return false unless object_validator.valid?(@object) + result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) + return false unless result_validator.valid?(@result) + status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED", "ROLLED_BACK"]) + return false unless status_validator.valid?(@status) + related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) + return false unless related_object_type_validator.valid?(@related_object_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + date == o.date && + customer_id == o.customer_id && + tracking_id == o.tracking_id && + metadata == o.metadata && + amount == o.amount && + redemption == o.redemption && + result == o.result && + status == o.status && + related_redemptions == o.related_redemptions && + failure_code == o.failure_code && + failure_message == o.failure_message && + order == o.order && + channel == o.channel && + customer == o.customer && + related_object_type == o.related_object_type && + related_object_id == o.related_object_id && + voucher == o.voucher && + promotion_tier == o.promotion_tier && + reward == o.reward && + gift == o.gift && + loyalty_card == o.loyalty_card && + reason == o.reason + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, date, customer_id, tracking_id, metadata, amount, redemption, result, status, related_redemptions, failure_code, failure_message, order, channel, customer, related_object_type, related_object_id, voucher, promotion_tier, reward, gift, loyalty_card, reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_channel.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_channel.rb new file mode 100644 index 00000000..c1c4bce5 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_channel.rb @@ -0,0 +1,242 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemChannel + attr_accessor :channel_id + + # The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + attr_accessor :channel_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_type' => :'channel_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'channel_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_type') + self.channel_type = attributes[:'channel_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) + return false unless channel_type_validator.valid?(@channel_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_type == o.channel_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [channel_id, channel_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_customer.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_customer.rb new file mode 100644 index 00000000..a77d7ffc --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_customer.rb @@ -0,0 +1,288 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemCustomer + # Unique identifier of an existing customer. It is assigned by Voucherify. + attr_accessor :id + + # Customer's first and last name. + attr_accessor :name + + # Customer's email address. + attr_accessor :email + + # A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + attr_accessor :source_id + + attr_accessor :metadata + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'email' => :'email', + :'source_id' => :'source_id', + :'metadata' => :'metadata', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'email' => :'String', + :'source_id' => :'String', + :'metadata' => :'Object', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'email', + :'source_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + email == o.email && + source_id == o.source_id && + metadata == o.metadata && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, email, source_id, metadata, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_gift.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_gift.rb new file mode 100644 index 00000000..845baa57 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_gift.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemGift + # Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_loyalty_card.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_loyalty_card.rb new file mode 100644 index 00000000..a3353b90 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_loyalty_card.rb @@ -0,0 +1,208 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemLoyaltyCard + # Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb new file mode 100644 index 00000000..3927fe13 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb @@ -0,0 +1,462 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemOrder + # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + attr_accessor :id + + # Unique source ID of an existing order that will be linked to the redemption of this request. + attr_accessor :source_id + + # The order status. + attr_accessor :status + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :amount + + # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + attr_accessor :initial_amount + + # Sum of all order-level discounts applied to the order. + attr_accessor :discount_amount + + # Sum of all product-specific discounts applied to the order. + attr_accessor :items_discount_amount + + # Sum of all order-level AND all product-specific discounts applied to the order. + attr_accessor :total_discount_amount + + # Order amount after undoing all the discounts through the rollback redemption. + attr_accessor :total_amount + + # This field shows the order-level discount applied. + attr_accessor :applied_discount_amount + + # Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + attr_accessor :items_applied_discount_amount + + # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + attr_accessor :total_applied_discount_amount + + # Array of items applied to the order. + attr_accessor :items + + attr_accessor :metadata + + # The type of the object represented by JSON. + attr_accessor :object + + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the order was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer ID of the customer making the purchase. + attr_accessor :customer_id + + # Unique referrer ID. + attr_accessor :referrer_id + + attr_accessor :customer + + attr_accessor :referrer + + attr_accessor :redemptions + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'status' => :'status', + :'amount' => :'amount', + :'initial_amount' => :'initial_amount', + :'discount_amount' => :'discount_amount', + :'items_discount_amount' => :'items_discount_amount', + :'total_discount_amount' => :'total_discount_amount', + :'total_amount' => :'total_amount', + :'applied_discount_amount' => :'applied_discount_amount', + :'items_applied_discount_amount' => :'items_applied_discount_amount', + :'total_applied_discount_amount' => :'total_applied_discount_amount', + :'items' => :'items', + :'metadata' => :'metadata', + :'object' => :'object', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'customer_id' => :'customer_id', + :'referrer_id' => :'referrer_id', + :'customer' => :'customer', + :'referrer' => :'referrer', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'status' => :'String', + :'amount' => :'Integer', + :'initial_amount' => :'Integer', + :'discount_amount' => :'Integer', + :'items_discount_amount' => :'Integer', + :'total_discount_amount' => :'Integer', + :'total_amount' => :'Integer', + :'applied_discount_amount' => :'Integer', + :'items_applied_discount_amount' => :'Integer', + :'total_applied_discount_amount' => :'Integer', + :'items' => :'Array', + :'metadata' => :'Object', + :'object' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'customer_id' => :'String', + :'referrer_id' => :'String', + :'customer' => :'RedemptionsListResponseBodyRedemptionsItemOrderCustomer', + :'referrer' => :'RedemptionsListResponseBodyRedemptionsItemOrderReferrer', + :'redemptions' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'status', + :'amount', + :'initial_amount', + :'discount_amount', + :'items_discount_amount', + :'total_discount_amount', + :'total_amount', + :'applied_discount_amount', + :'items_applied_discount_amount', + :'total_applied_discount_amount', + :'items', + :'object', + :'created_at', + :'updated_at', + :'customer_id', + :'referrer_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'initial_amount') + self.initial_amount = attributes[:'initial_amount'] + end + + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + + if attributes.key?(:'items_discount_amount') + self.items_discount_amount = attributes[:'items_discount_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'applied_discount_amount') + self.applied_discount_amount = attributes[:'applied_discount_amount'] + end + + if attributes.key?(:'items_applied_discount_amount') + self.items_applied_discount_amount = attributes[:'items_applied_discount_amount'] + end + + if attributes.key?(:'total_applied_discount_amount') + self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] + end + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'order' + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] + end + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) + return false unless status_validator.valid?(@status) + object_validator = EnumAttributeValidator.new('String', ["order"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + status == o.status && + amount == o.amount && + initial_amount == o.initial_amount && + discount_amount == o.discount_amount && + items_discount_amount == o.items_discount_amount && + total_discount_amount == o.total_discount_amount && + total_amount == o.total_amount && + applied_discount_amount == o.applied_discount_amount && + items_applied_discount_amount == o.items_applied_discount_amount && + total_applied_discount_amount == o.total_applied_discount_amount && + items == o.items && + metadata == o.metadata && + object == o.object && + created_at == o.created_at && + updated_at == o.updated_at && + customer_id == o.customer_id && + referrer_id == o.referrer_id && + customer == o.customer && + referrer == o.referrer && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, status, amount, initial_amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, applied_discount_amount, items_applied_discount_amount, total_applied_discount_amount, items, metadata, object, created_at, updated_at, customer_id, referrer_id, customer, referrer, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_customer.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_customer.rb new file mode 100644 index 00000000..c0c0e6ce --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_customer.rb @@ -0,0 +1,246 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemOrderCustomer + # A unique identifier of an existing customer. + attr_accessor :id + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_referrer.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_referrer.rb new file mode 100644 index 00000000..86694fdb --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order_referrer.rb @@ -0,0 +1,246 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemOrderReferrer + # A unique identifier of an existing customer. + attr_accessor :id + + # The type of the object represented by JSON. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'customer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["customer"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier.rb new file mode 100644 index 00000000..735dd315 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier.rb @@ -0,0 +1,452 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemPromotionTier + # Unique promotion tier ID. + attr_accessor :id + + # Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # Name of the promotion tier. + attr_accessor :name + + # Text to be displayed to your customers on your website. + attr_accessor :banner + + attr_accessor :action + + attr_accessor :metadata + + # The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + attr_accessor :hierarchy + + # Promotion unique ID. + attr_accessor :promotion_id + + attr_accessor :campaign + + # Promotion tier's parent campaign's unique ID. + attr_accessor :campaign_id + + # A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + attr_accessor :active + + # Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + attr_accessor :start_date + + # Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + attr_accessor :summary + + # The type of the object represented by JSON. This object stores information about the promotion tier. + attr_accessor :object + + attr_accessor :validation_rule_assignments + + # Promotion tier category ID. + attr_accessor :category_id + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'name' => :'name', + :'banner' => :'banner', + :'action' => :'action', + :'metadata' => :'metadata', + :'hierarchy' => :'hierarchy', + :'promotion_id' => :'promotion_id', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'active' => :'active', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'summary' => :'summary', + :'object' => :'object', + :'validation_rule_assignments' => :'validation_rule_assignments', + :'category_id' => :'category_id', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'name' => :'String', + :'banner' => :'String', + :'action' => :'RedemptionsListResponseBodyRedemptionsItemPromotionTierAction', + :'metadata' => :'Object', + :'hierarchy' => :'Integer', + :'promotion_id' => :'String', + :'campaign' => :'RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign', + :'campaign_id' => :'String', + :'active' => :'Boolean', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'summary' => :'RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary', + :'object' => :'String', + :'validation_rule_assignments' => :'ValidationRuleAssignmentsList', + :'category_id' => :'String', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'created_at', + :'updated_at', + :'name', + :'banner', + :'hierarchy', + :'promotion_id', + :'campaign_id', + :'active', + :'start_date', + :'expiration_date', + :'object', + :'category_id', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'banner') + self.banner = attributes[:'banner'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'hierarchy') + self.hierarchy = attributes[:'hierarchy'] + end + + if attributes.key?(:'promotion_id') + self.promotion_id = attributes[:'promotion_id'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'promotion_tier' + end + + if attributes.key?(:'validation_rule_assignments') + self.validation_rule_assignments = attributes[:'validation_rule_assignments'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + updated_at == o.updated_at && + name == o.name && + banner == o.banner && + action == o.action && + metadata == o.metadata && + hierarchy == o.hierarchy && + promotion_id == o.promotion_id && + campaign == o.campaign && + campaign_id == o.campaign_id && + active == o.active && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + summary == o.summary && + object == o.object && + validation_rule_assignments == o.validation_rule_assignments && + category_id == o.category_id && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, updated_at, name, banner, action, metadata, hierarchy, promotion_id, campaign, campaign_id, active, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, summary, object, validation_rule_assignments, category_id, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_action.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_action.rb new file mode 100644 index 00000000..43e422b9 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_action.rb @@ -0,0 +1,207 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemPromotionTierAction + attr_accessor :discount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign.rb new file mode 100644 index 00000000..61607e20 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign.rb @@ -0,0 +1,318 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign + # Unique campaign ID. + attr_accessor :id + + # Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + attr_accessor :active + + # Unique category ID that this campaign belongs to. + attr_accessor :category_id + + # The type of the object represented by the campaign object. This object stores information about the campaign. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'category_id' => :'category_id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'category_id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'start_date', + :'expiration_date', + :'active', + :'category_id', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'campaign' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + category_id == o.category_id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, category_id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary.rb new file mode 100644 index 00000000..0472ee98 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary.rb @@ -0,0 +1,216 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary + attr_accessor :redemptions + + attr_accessor :orders + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'redemptions' => :'redemptions', + :'orders' => :'orders' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'redemptions' => :'RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions', + :'orders' => :'RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'redemptions') + self.redemptions = attributes[:'redemptions'] + end + + if attributes.key?(:'orders') + self.orders = attributes[:'orders'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + redemptions == o.redemptions && + orders == o.orders + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [redemptions, orders].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders.rb new file mode 100644 index 00000000..6575a3ad --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders.rb @@ -0,0 +1,220 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders + # Sum of order totals. + attr_accessor :total_amount + + # Sum of total discount applied using the promotion tier. + attr_accessor :total_discount_amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_amount' => :'total_amount', + :'total_discount_amount' => :'total_discount_amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_amount' => :'Integer', + :'total_discount_amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_amount', + :'total_discount_amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_amount') + self.total_amount = attributes[:'total_amount'] + end + + if attributes.key?(:'total_discount_amount') + self.total_discount_amount = attributes[:'total_discount_amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_amount == o.total_amount && + total_discount_amount == o.total_discount_amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_amount, total_discount_amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions.rb new file mode 100644 index 00000000..1229ef93 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions + # Number of times the promotion tier was redeemed. + attr_accessor :total_redeemed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_redeemed' => :'total_redeemed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_redeemed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'total_redeemed' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'total_redeemed') + self.total_redeemed = attributes[:'total_redeemed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_redeemed == o.total_redeemed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_redeemed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions.rb new file mode 100644 index 00000000..1ced9121 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions + attr_accessor :rollbacks + + attr_accessor :redemptions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rollbacks' => :'rollbacks', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rollbacks' => :'Array', + :'redemptions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'rollbacks') + if (value = attributes[:'rollbacks']).is_a?(Array) + self.rollbacks = value + end + end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Array) + self.redemptions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rollbacks == o.rollbacks && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rollbacks, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..709d6584 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item.rb new file mode 100644 index 00000000..1c90bbc5 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item.rb @@ -0,0 +1,217 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher.rb new file mode 100644 index 00000000..0d2f4678 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher.rb @@ -0,0 +1,535 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemVoucher + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + attr_accessor :holder + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments', + :'holder' => :'holder' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'RedemptionsListResponseBodyRedemptionsItemVoucherGift', + :'loyalty_card' => :'RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'RedemptionsListResponseBodyRedemptionsItemVoucherPublish', + :'redemption' => :'RedemptionsListResponseBodyRedemptionsItemVoucherRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', + :'holder' => :'SimpleCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + + if attributes.key?(:'holder') + self.holder = attributes[:'holder'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments && + holder == o.holder + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments, holder].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_gift.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_gift.rb new file mode 100644 index 00000000..17748a1c --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_gift.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemVoucherGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.rb new file mode 100644 index 00000000..2b33c0cd --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.rb @@ -0,0 +1,242 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_publish.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_publish.rb new file mode 100644 index 00000000..9d8b8959 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_publish.rb @@ -0,0 +1,233 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemVoucherPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_redemption.rb b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_redemption.rb new file mode 100644 index 00000000..13f600d9 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_redemption.rb @@ -0,0 +1,255 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsListResponseBodyRedemptionsItemVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_redeem_request_body.rb b/lib/VoucherifySdk/models/redemptions_redeem_request_body.rb index 77165144..68067058 100644 --- a/lib/VoucherifySdk/models/redemptions_redeem_request_body.rb +++ b/lib/VoucherifySdk/models/redemptions_redeem_request_body.rb @@ -14,9 +14,10 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/redemptions`. + # Response body schema for **POST** `v1/redemptions`. class RedemptionsRedeemRequestBody - # An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. + attr_accessor :options + attr_accessor :redeemables attr_accessor :order @@ -31,18 +32,16 @@ class RedemptionsRedeemRequestBody # A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. attr_accessor :metadata - attr_accessor :options - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'options' => :'options', :'redeemables' => :'redeemables', :'order' => :'order', :'customer' => :'customer', :'session' => :'session', :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'options' => :'options' + :'metadata' => :'metadata' } end @@ -54,50 +53,42 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'redeemables' => :'Array', + :'options' => :'RedemptionsRedeemRequestBodyOptions', + :'redeemables' => :'Array', :'order' => :'Order', :'customer' => :'Customer', :'session' => :'Session', :'tracking_id' => :'String', - :'metadata' => :'Object', - :'options' => :'ClientRedemptionsRedeemRequestBodyAllOfOptions' + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'options', + :'redeemables', + :'tracking_id', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'StackableValidateRedeemBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsRedeemRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsRedeemRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + if attributes.key?(:'redeemables') if (value = attributes[:'redeemables']).is_a?(Array) self.redeemables = value end - else - self.redeemables = nil end if attributes.key?(:'order') @@ -119,10 +110,6 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'options') - self.options = attributes[:'options'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -130,18 +117,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') - end - - if @redeemables.length > 5 - invalid_properties.push('invalid value for "redeemables", number of items must be less than or equal to 5.') - end - - if @redeemables.length < 1 - invalid_properties.push('invalid value for "redeemables", number of items must be greater than or equal to 1.') - end - invalid_properties end @@ -149,42 +124,21 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemables.nil? - return false if @redeemables.length > 5 - return false if @redeemables.length < 1 true end - # Custom attribute writer method with validation - # @param [Object] redeemables Value to be assigned - def redeemables=(redeemables) - if redeemables.nil? - fail ArgumentError, 'redeemables cannot be nil' - end - - if redeemables.length > 5 - fail ArgumentError, 'invalid value for "redeemables", number of items must be less than or equal to 5.' - end - - if redeemables.length < 1 - fail ArgumentError, 'invalid value for "redeemables", number of items must be greater than or equal to 1.' - end - - @redeemables = redeemables - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + options == o.options && redeemables == o.redeemables && order == o.order && customer == o.customer && session == o.session && tracking_id == o.tracking_id && - metadata == o.metadata && - options == o.options + metadata == o.metadata end # @see the `==` method @@ -196,7 +150,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [redeemables, order, customer, session, tracking_id, metadata, options].hash + [options, redeemables, order, customer, session, tracking_id, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/redemptions_redeem_request_body_options.rb b/lib/VoucherifySdk/models/redemptions_redeem_request_body_options.rb new file mode 100644 index 00000000..3e81d74d --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_redeem_request_body_options.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Configure parameters returned in the response. + class RedemptionsRedeemRequestBodyOptions + # Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. | + attr_accessor :expand + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expand' => :'expand' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expand' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'expand' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'expand') + if (value = attributes[:'expand']).is_a?(Array) + self.expand = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expand == o.expand + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expand].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item.rb b/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item.rb new file mode 100644 index 00000000..57450097 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item.rb @@ -0,0 +1,260 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsRedeemRequestBodyRedeemablesItem + attr_accessor :object + + attr_accessor :id + + attr_accessor :gift + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'id' => :'id', + :'gift' => :'gift', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'id' => :'String', + :'gift' => :'RedemptionsRedeemRequestBodyRedeemablesItemGift', + :'reward' => :'RedemptionsRedeemRequestBodyRedeemablesItemReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'gift', + :'reward' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "promotion_stack"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + id == o.id && + gift == o.gift && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, id, gift, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_gift.rb b/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_gift.rb new file mode 100644 index 00000000..3b2f117d --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information on the number of gift card credits that the customer wants to apply to the order. + class RedemptionsRedeemRequestBodyRedeemablesItemGift + # The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + attr_accessor :credits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credits' => :'credits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credits' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'credits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'credits') + self.credits = attributes[:'credits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credits == o.credits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_reward.rb b/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_reward.rb new file mode 100644 index 00000000..1b142e57 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_redeem_request_body_redeemables_item_reward.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + class RedemptionsRedeemRequestBodyRedeemablesItemReward + # Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + attr_accessor :id + + # The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_redeem_response_body.rb b/lib/VoucherifySdk/models/redemptions_redeem_response_body.rb index 13aba711..a6707cf1 100644 --- a/lib/VoucherifySdk/models/redemptions_redeem_response_body.rb +++ b/lib/VoucherifySdk/models/redemptions_redeem_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/redemptions`. + # Response body schema for **POST** `v1/redemptions`. class RedemptionsRedeemResponseBody attr_accessor :redemptions @@ -58,21 +58,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'redemptions', + :'inapplicable_redeemables', + :'skipped_redeemables' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsRedeemResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsRedeemResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_request_body.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_request_body.rb index 0439c7cb..41b63ebd 100644 --- a/lib/VoucherifySdk/models/redemptions_rollback_create_request_body.rb +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/redemptions/{redemptionId}/rollback`. + # Request body schema for **POST** `v1/redemptions/{redemptionId}/rollback`. class RedemptionsRollbackCreateRequestBody # Reason for the rollback. attr_accessor :reason @@ -59,21 +59,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'reason', + :'tracking_id', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsRollbackCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsRollbackCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body.rb index ce3c93b6..678198c9 100644 --- a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body.rb +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body.rb @@ -14,15 +14,15 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/redemptions/{redemptionId}/rollback`. + # Response body schema for **POST** `v1/redemptions/{redemptionId}/rollback`. class RedemptionsRollbackCreateResponseBody - # Unique redemption ID. + # Unique identifier of the redemption rollback. attr_accessor :id - # The type of object represented by the JSON + # The type of the object represented by the JSON attr_accessor :object - # Timestamp representing the date and time when the object was created in ISO 8601 format. + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. attr_accessor :date # Unique customer ID of the redeeming customer. @@ -34,7 +34,7 @@ class RedemptionsRollbackCreateResponseBody # The metadata object stores all custom attributes assigned to the redemption. attr_accessor :metadata - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + # For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. attr_accessor :amount # Unique redemption ID of the parent redemption. @@ -66,7 +66,7 @@ class RedemptionsRollbackCreateResponseBody # Defines the related object. attr_accessor :related_object_type - # Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. + # Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. attr_accessor :related_object_id attr_accessor :voucher @@ -150,60 +150,57 @@ def self.openapi_types :'reason' => :'String', :'result' => :'String', :'status' => :'String', - :'related_redemptions' => :'RedemptionRollbackRelatedRedemptions', + :'related_redemptions' => :'RedemptionsRollbackCreateResponseBodyRelatedRedemptions', :'failure_code' => :'String', :'failure_message' => :'String', - :'order' => :'OrderCalculatedNoCustomerData', - :'channel' => :'RedemptionChannel', + :'order' => :'OrderCalculated', + :'channel' => :'RedemptionsRollbackCreateResponseBodyChannel', :'customer' => :'SimpleCustomer', :'related_object_type' => :'String', :'related_object_id' => :'String', :'voucher' => :'Voucher', :'promotion_tier' => :'PromotionTier', :'reward' => :'RedemptionRewardResult', - :'gift' => :'RedemptionGift', - :'loyalty_card' => :'RedemptionLoyaltyCard' + :'gift' => :'RedemptionsRollbackCreateResponseBodyGift', + :'loyalty_card' => :'RedemptionsRollbackCreateResponseBodyLoyaltyCard' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'date', :'customer_id', :'tracking_id', :'metadata', + :'amount', :'redemption', - :'order', - :'customer', + :'reason', + :'result', + :'status', + :'related_redemptions', + :'failure_code', + :'failure_message', + :'channel', + :'related_object_type', + :'related_object_id', + :'gift', + :'loyalty_card' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RedemptionRollback' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsRollbackCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsRollbackCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -214,26 +211,18 @@ def initialize(attributes = {}) if attributes.key?(:'date') self.date = attributes[:'date'] - else - self.date = nil end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] - else - self.customer_id = nil end if attributes.key?(:'tracking_id') self.tracking_id = attributes[:'tracking_id'] - else - self.tracking_id = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'amount') @@ -242,8 +231,6 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] - else - self.redemption = nil end if attributes.key?(:'reason') @@ -252,14 +239,10 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'status') self.status = attributes[:'status'] - else - self.status = nil end if attributes.key?(:'related_redemptions') @@ -276,32 +259,22 @@ def initialize(attributes = {}) if attributes.key?(:'order') self.order = attributes[:'order'] - else - self.order = nil end if attributes.key?(:'channel') self.channel = attributes[:'channel'] - else - self.channel = nil end if attributes.key?(:'customer') self.customer = attributes[:'customer'] - else - self.customer = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'voucher') @@ -330,38 +303,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @date.nil? - invalid_properties.push('invalid value for "date", date cannot be nil.') - end - - if @result.nil? - invalid_properties.push('invalid value for "result", result cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - invalid_properties end @@ -369,65 +310,17 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["redemption_rollback"]) return false unless object_validator.valid?(@object) - return false if @date.nil? - return false if @result.nil? result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) return false unless result_validator.valid?(@result) - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED"]) return false unless status_validator.valid?(@status) - return false if @channel.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) return false unless related_object_type_validator.valid?(@related_object_type) - return false if @related_object_id.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["redemption_rollback"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SUCCEEDED", "FAILED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "redemption"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_channel.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_channel.rb new file mode 100644 index 00000000..2810eaa9 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_channel.rb @@ -0,0 +1,245 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the details of the channel through which the redemption was issued. + class RedemptionsRollbackCreateResponseBodyChannel + # Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. + attr_accessor :channel_id + + # The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + attr_accessor :channel_type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_type' => :'channel_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'channel_id', + :'channel_type' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_type') + self.channel_type = attributes[:'channel_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + channel_type_validator = EnumAttributeValidator.new('String', ["USER", "API"]) + return false unless channel_type_validator.valid?(@channel_type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_type == o.channel_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [channel_id, channel_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_gift.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_gift.rb new file mode 100644 index 00000000..db355ec5 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the amount returned to the gift card in the redemption rollback. It is expressed as a negative integer. + class RedemptionsRollbackCreateResponseBodyGift + # Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_loyalty_card.rb new file mode 100644 index 00000000..ab757615 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_loyalty_card.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the number of points returned to the loyalty card in the reward redemption rollback. It is expressed as a negative integer. + class RedemptionsRollbackCreateResponseBodyLoyaltyCard + # Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions.rb new file mode 100644 index 00000000..c540ab52 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions.rb @@ -0,0 +1,222 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsRollbackCreateResponseBodyRelatedRedemptions + attr_accessor :rollbacks + + attr_accessor :redemptions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rollbacks' => :'rollbacks', + :'redemptions' => :'redemptions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rollbacks' => :'Array', + :'redemptions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'rollbacks', + :'redemptions' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'rollbacks') + if (value = attributes[:'rollbacks']).is_a?(Array) + self.rollbacks = value + end + end + + if attributes.key?(:'redemptions') + if (value = attributes[:'redemptions']).is_a?(Array) + self.redemptions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rollbacks == o.rollbacks && + redemptions == o.redemptions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rollbacks, redemptions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item.rb new file mode 100644 index 00000000..8f9c557b --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem + # Unique redemption ID. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item.rb b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item.rb new file mode 100644 index 00000000..c45e29f4 --- /dev/null +++ b/lib/VoucherifySdk/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item.rb @@ -0,0 +1,218 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem + # Unique identifier of the redemption rollback. + attr_accessor :id + + # Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + attr_accessor :date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/redemptions_rollbacks_create_request_body.rb b/lib/VoucherifySdk/models/redemptions_rollbacks_create_request_body.rb index 597974c0..90075e6b 100644 --- a/lib/VoucherifySdk/models/redemptions_rollbacks_create_request_body.rb +++ b/lib/VoucherifySdk/models/redemptions_rollbacks_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/redemptions/{parentRedemptionId}/rollbacks`. + # Request body schema for **POST** `v1/redemptions/{parentRedemptionId}/rollbacks`. class RedemptionsRollbacksCreateRequestBody # Reason for the rollback. attr_accessor :reason @@ -59,21 +59,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'reason', + :'tracking_id', + :'metadata' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsRollbacksCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsRollbacksCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/redemptions_rollbacks_create_response_body.rb b/lib/VoucherifySdk/models/redemptions_rollbacks_create_response_body.rb index 5503e64e..86b7311c 100644 --- a/lib/VoucherifySdk/models/redemptions_rollbacks_create_response_body.rb +++ b/lib/VoucherifySdk/models/redemptions_rollbacks_create_response_body.rb @@ -42,28 +42,22 @@ def self.openapi_types { :'rollbacks' => :'Array', :'parent_rollback' => :'RedemptionRollback', - :'order' => :'OrderCalculatedNoCustomerData' + :'order' => :'OrderCalculated' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'rollbacks', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RedemptionsRollbacksCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RedemptionsRollbacksCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/referral_campaign_voucher.rb b/lib/VoucherifySdk/models/referral_campaign_voucher.rb deleted file mode 100644 index 826720eb..00000000 --- a/lib/VoucherifySdk/models/referral_campaign_voucher.rb +++ /dev/null @@ -1,307 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ReferralCampaignVoucher - # Type of voucher. - attr_accessor :type - - attr_accessor :discount - - attr_accessor :code_config - - attr_accessor :redemption - - # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. - attr_accessor :is_referral_code - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'discount' => :'discount', - :'code_config' => :'code_config', - :'redemption' => :'redemption', - :'is_referral_code' => :'is_referral_code' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'type' => :'String', - :'discount' => :'Discount', - :'code_config' => :'CodeConfig', - :'redemption' => :'CampaignLoyaltyVoucherRedemption', - :'is_referral_code' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferralCampaignVoucher` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferralCampaignVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'DISCOUNT_VOUCHER' - end - - if attributes.key?(:'discount') - self.discount = attributes[:'discount'] - else - self.discount = nil - end - - if attributes.key?(:'code_config') - self.code_config = attributes[:'code_config'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'is_referral_code') - self.is_referral_code = attributes[:'is_referral_code'] - else - self.is_referral_code = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @discount.nil? - invalid_properties.push('invalid value for "discount", discount cannot be nil.') - end - - if @is_referral_code.nil? - invalid_properties.push('invalid value for "is_referral_code", is_referral_code cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER"]) - return false unless type_validator.valid?(@type) - return false if @discount.nil? - return false if @is_referral_code.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - discount == o.discount && - code_config == o.code_config && - redemption == o.redemption && - is_referral_code == o.is_referral_code - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [type, discount, code_config, redemption, is_referral_code].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/referral_program.rb b/lib/VoucherifySdk/models/referral_program.rb index 618545f1..ee47d966 100644 --- a/lib/VoucherifySdk/models/referral_program.rb +++ b/lib/VoucherifySdk/models/referral_program.rb @@ -71,21 +71,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'conversion_event_type', + :'custom_event', + :'referee_reward' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferralProgram` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferralProgram`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -119,16 +115,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] conversion_event_type Object to be assigned - def conversion_event_type=(conversion_event_type) - validator = EnumAttributeValidator.new('String', ["redemption", "custom_event"]) - unless validator.valid?(conversion_event_type) - fail ArgumentError, "invalid value for \"conversion_event_type\", must be one of #{validator.allowable_values}." - end - @conversion_event_type = conversion_event_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/referral_program_custom_event.rb b/lib/VoucherifySdk/models/referral_program_custom_event.rb index 3f9daa5c..13ef529f 100644 --- a/lib/VoucherifySdk/models/referral_program_custom_event.rb +++ b/lib/VoucherifySdk/models/referral_program_custom_event.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferralProgramCustomEvent` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferralProgramCustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/referral_program_referee_reward.rb b/lib/VoucherifySdk/models/referral_program_referee_reward.rb index 0d71c213..cf2ec2ea 100644 --- a/lib/VoucherifySdk/models/referral_program_referee_reward.rb +++ b/lib/VoucherifySdk/models/referral_program_referee_reward.rb @@ -72,21 +72,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'related_object_parent', + :'type', + :'amount' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferralProgramRefereeReward` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferralProgramRefereeReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -120,16 +116,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER", "LOYALTY_CARD", "GIFT_VOUCHER", "LUCKY_DRAW_CODE"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/referral_program_referee_reward_related_object_parent.rb b/lib/VoucherifySdk/models/referral_program_referee_reward_related_object_parent.rb index 851d4c5f..f4c4df8b 100644 --- a/lib/VoucherifySdk/models/referral_program_referee_reward_related_object_parent.rb +++ b/lib/VoucherifySdk/models/referral_program_referee_reward_related_object_parent.rb @@ -73,21 +73,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferralProgramRefereeRewardRelatedObjectParent` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferralProgramRefereeRewardRelatedObjectParent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -123,16 +119,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["CAMPAIGN"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/referrer.rb b/lib/VoucherifySdk/models/referrer.rb index fd4ca921..54a5d644 100644 --- a/lib/VoucherifySdk/models/referrer.rb +++ b/lib/VoucherifySdk/models/referrer.rb @@ -33,7 +33,7 @@ class Referrer # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. attr_accessor :phone - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. + # `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. attr_accessor :birthday # Customer's birthdate; format YYYY-MM-DD. @@ -76,7 +76,7 @@ def self.openapi_types :'phone' => :'String', :'birthday' => :'Date', :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', + :'address' => :'ReferrerAddress', :'metadata' => :'Object' } end @@ -84,29 +84,24 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name', + :'description', + :'email', + :'phone', + :'birthday', + :'birthdate', :'address', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Customer' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Referrer` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Referrer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/referrer_address.rb b/lib/VoucherifySdk/models/referrer_address.rb new file mode 100644 index 00000000..c8272372 --- /dev/null +++ b/lib/VoucherifySdk/models/referrer_address.rb @@ -0,0 +1,265 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Customer's address. + class ReferrerAddress + # City + attr_accessor :city + + # State + attr_accessor :state + + # First line of address. + attr_accessor :line_1 + + # Second line of address. + attr_accessor :line_2 + + # Country. + attr_accessor :country + + # Postal code. + attr_accessor :postal_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'state' => :'state', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'country' => :'country', + :'postal_code' => :'postal_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'state' => :'String', + :'line_1' => :'String', + :'line_2' => :'String', + :'country' => :'String', + :'postal_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'city', + :'state', + :'line_1', + :'line_2', + :'country', + :'postal_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + state == o.state && + line_1 == o.line_1 && + line_2 == o.line_2 && + country == o.country && + postal_code == o.postal_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, state, line_1, line_2, country, postal_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/referrer_id.rb b/lib/VoucherifySdk/models/referrer_id.rb index 541a8252..1d1ae2ef 100644 --- a/lib/VoucherifySdk/models/referrer_id.rb +++ b/lib/VoucherifySdk/models/referrer_id.rb @@ -18,7 +18,7 @@ class ReferrerId # A unique identifier of an existing customer. attr_accessor :id - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object class EnumAttributeValidator @@ -67,35 +67,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerId' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferrerId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferrerId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -110,14 +96,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -125,23 +103,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["customer"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/referrer_with_summary_loyalty_referrals.rb b/lib/VoucherifySdk/models/referrer_with_summary_loyalty_referrals.rb deleted file mode 100644 index 2d59b229..00000000 --- a/lib/VoucherifySdk/models/referrer_with_summary_loyalty_referrals.rb +++ /dev/null @@ -1,438 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ReferrerWithSummaryLoyaltyReferrals - # The ID of an existing customer that will be linked to redemption in this request. - attr_accessor :id - - # A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. - attr_accessor :source_id - - attr_accessor :summary - - attr_accessor :loyalty - - attr_accessor :referrals - - # Object used to store system metadata information. - attr_accessor :system_metadata - - # Timestamp representing the date and time when the customer was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the customer was updated in ISO 8601 format. - attr_accessor :updated_at - - attr_accessor :assets - - # The type of object represented by JSON. - attr_accessor :object - - # Customer's first and last name. - attr_accessor :name - - # An arbitrary string that you can attach to a customer object. - attr_accessor :description - - # Customer's email address. - attr_accessor :email - - # Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. - attr_accessor :phone - - # *Deprecated* Customer's birthdate; format YYYY-MM-DD. - attr_accessor :birthday - - # Customer's birthdate; format YYYY-MM-DD. - attr_accessor :birthdate - - attr_accessor :address - - # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. - attr_accessor :metadata - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'summary' => :'summary', - :'loyalty' => :'loyalty', - :'referrals' => :'referrals', - :'system_metadata' => :'system_metadata', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'assets' => :'assets', - :'object' => :'object', - :'name' => :'name', - :'description' => :'description', - :'email' => :'email', - :'phone' => :'phone', - :'birthday' => :'birthday', - :'birthdate' => :'birthdate', - :'address' => :'address', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'summary' => :'CustomerSummary', - :'loyalty' => :'CustomerLoyalty', - :'referrals' => :'CustomerReferrals', - :'system_metadata' => :'Object', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'assets' => :'CustomerResponseDataAssets', - :'object' => :'String', - :'name' => :'String', - :'description' => :'String', - :'email' => :'String', - :'phone' => :'String', - :'birthday' => :'Date', - :'birthdate' => :'Date', - :'address' => :'CustomerBaseAddress', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'summary', - :'loyalty', - :'referrals', - :'address', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'CustomerWithSummaryLoyaltyReferrals' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ReferrerWithSummaryLoyaltyReferrals` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ReferrerWithSummaryLoyaltyReferrals`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'summary') - self.summary = attributes[:'summary'] - else - self.summary = nil - end - - if attributes.key?(:'loyalty') - self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil - end - - if attributes.key?(:'referrals') - self.referrals = attributes[:'referrals'] - else - self.referrals = nil - end - - if attributes.key?(:'system_metadata') - self.system_metadata = attributes[:'system_metadata'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'assets') - self.assets = attributes[:'assets'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'customer' - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'email') - self.email = attributes[:'email'] - end - - if attributes.key?(:'phone') - self.phone = attributes[:'phone'] - end - - if attributes.key?(:'birthday') - self.birthday = attributes[:'birthday'] - end - - if attributes.key?(:'birthdate') - self.birthdate = attributes[:'birthdate'] - end - - if attributes.key?(:'address') - self.address = attributes[:'address'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["customer"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - summary == o.summary && - loyalty == o.loyalty && - referrals == o.referrals && - system_metadata == o.system_metadata && - created_at == o.created_at && - updated_at == o.updated_at && - assets == o.assets && - object == o.object && - name == o.name && - description == o.description && - email == o.email && - phone == o.phone && - birthday == o.birthday && - birthdate == o.birthdate && - address == o.address && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, summary, loyalty, referrals, system_metadata, created_at, updated_at, assets, object, name, description, email, phone, birthday, birthdate, address, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward.rb b/lib/VoucherifySdk/models/reward.rb index fad59756..21e17398 100644 --- a/lib/VoucherifySdk/models/reward.rb +++ b/lib/VoucherifySdk/models/reward.rb @@ -37,13 +37,13 @@ class Reward attr_accessor :parameters - # Timestamp representing the date and time when the reward was created in ISO 8601 format. + # Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward. + # The type of the object represented by the JSON. This object stores information about the reward. attr_accessor :object class EnumAttributeValidator @@ -110,8 +110,14 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', :'stock', :'redeemed', + :'attributes', + :'metadata', + :'type', + :'created_at', :'updated_at', ]) end @@ -119,40 +125,25 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Reward` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Reward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'stock') self.stock = attributes[:'stock'] - else - self.stock = nil end if attributes.key?(:'redeemed') self.redeemed = attributes[:'redeemed'] - else - self.redeemed = nil end if attributes.key?(:'attributes') @@ -161,14 +152,10 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'parameters') @@ -177,14 +164,10 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -199,26 +182,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end @@ -230,39 +193,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @metadata.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) return false unless type_validator.valid?(@type) - return false if @created_at.nil? return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/reward_assignment.rb b/lib/VoucherifySdk/models/reward_assignment.rb index 41bf3e22..b1e55cb3 100644 --- a/lib/VoucherifySdk/models/reward_assignment.rb +++ b/lib/VoucherifySdk/models/reward_assignment.rb @@ -21,13 +21,13 @@ class RewardAssignment # Associated reward ID. attr_accessor :reward_id - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward assignment. + # The type of the object represented by the JSON. This object stores information about the reward assignment. attr_accessor :object # Related object ID to which the reward was assigned. @@ -89,62 +89,46 @@ def self.openapi_types :'object' => :'String', :'related_object_id' => :'String', :'related_object_type' => :'String', - :'parameters' => :'RewardAssignmentParametersParameters' + :'parameters' => :'RewardAssignmentParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'reward_id', + :'created_at', :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RewardAssignmentBase', - :'RewardAssignmentParameters' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignment` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'reward_id') self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -155,8 +139,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') @@ -175,30 +157,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - invalid_properties end @@ -206,39 +164,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) return false unless related_object_type_validator.valid?(@related_object_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/reward_assignment_base.rb b/lib/VoucherifySdk/models/reward_assignment_base.rb deleted file mode 100644 index bdb39012..00000000 --- a/lib/VoucherifySdk/models/reward_assignment_base.rb +++ /dev/null @@ -1,366 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RewardAssignmentBase - # Unique reward assignment ID, assigned by Voucherify. - attr_accessor :id - - # Associated reward ID. - attr_accessor :reward_id - - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. - attr_accessor :updated_at - - # The type of object represented by the JSON. This object stores information about the reward assignment. - attr_accessor :object - - # Related object ID to which the reward was assigned. - attr_accessor :related_object_id - - # Related object type to which the reward was assigned. - attr_accessor :related_object_type - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'reward_id' => :'reward_id', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'object' => :'object', - :'related_object_id' => :'related_object_id', - :'related_object_type' => :'related_object_type' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'reward_id' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'object' => :'String', - :'related_object_id' => :'String', - :'related_object_type' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'updated_at', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'reward_id') - self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'reward_assignment' - end - - if attributes.key?(:'related_object_id') - self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil - end - - if attributes.key?(:'related_object_type') - self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = 'campaign' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? - related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) - return false unless related_object_type_validator.valid?(@related_object_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - reward_id == o.reward_id && - created_at == o.created_at && - updated_at == o.updated_at && - object == o.object && - related_object_id == o.related_object_id && - related_object_type == o.related_object_type - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, reward_id, created_at, updated_at, object, related_object_id, related_object_type].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_assignment_parameters.rb b/lib/VoucherifySdk/models/reward_assignment_parameters.rb index d3bacd29..652f186b 100644 --- a/lib/VoucherifySdk/models/reward_assignment_parameters.rb +++ b/lib/VoucherifySdk/models/reward_assignment_parameters.rb @@ -14,13 +14,14 @@ require 'time' module VoucherifySdk + # Defines the cost of the reward. class RewardAssignmentParameters - attr_accessor :parameters + attr_accessor :loyalty # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'parameters' => :'parameters' + :'loyalty' => :'loyalty' } end @@ -32,33 +33,27 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'parameters' => :'RewardAssignmentParametersParameters' + :'loyalty' => :'RewardAssignmentParametersLoyalty' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'loyalty' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentParameters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] end end @@ -82,7 +77,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - parameters == o.parameters + loyalty == o.loyalty end # @see the `==` method @@ -94,7 +89,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [parameters].hash + [loyalty].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/reward_assignment_parameters_loyalty.rb b/lib/VoucherifySdk/models/reward_assignment_parameters_loyalty.rb new file mode 100644 index 00000000..516562e3 --- /dev/null +++ b/lib/VoucherifySdk/models/reward_assignment_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class RewardAssignmentParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/reward_assignment_parameters_parameters.rb b/lib/VoucherifySdk/models/reward_assignment_parameters_parameters.rb deleted file mode 100644 index a39ca6a6..00000000 --- a/lib/VoucherifySdk/models/reward_assignment_parameters_parameters.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the cost of the reward. - class RewardAssignmentParametersParameters - attr_accessor :loyalty - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'loyalty' => :'loyalty' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'loyalty' => :'RewardAssignmentParametersParametersLoyalty' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentParametersParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentParametersParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'loyalty') - self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - loyalty == o.loyalty - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [loyalty].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_assignment_parameters_parameters_loyalty.rb b/lib/VoucherifySdk/models/reward_assignment_parameters_parameters_loyalty.rb deleted file mode 100644 index 926d7098..00000000 --- a/lib/VoucherifySdk/models/reward_assignment_parameters_parameters_loyalty.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the equivalent points value of the reward. - class RewardAssignmentParametersParametersLoyalty - # The number of points required to redeem the reward. - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentParametersParametersLoyalty` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentParametersParametersLoyalty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_assignments_create_coin_reward_request_body.rb b/lib/VoucherifySdk/models/reward_assignments_create_coin_reward_request_body.rb deleted file mode 100644 index 75e7cad2..00000000 --- a/lib/VoucherifySdk/models/reward_assignments_create_coin_reward_request_body.rb +++ /dev/null @@ -1,234 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Request body schema for **POST** `/rewards/{rewardID}/assignments`. - class RewardAssignmentsCreateCoinRewardRequestBody - # The campaign ID of the campaign to which the reward is to be assigned. - attr_accessor :campaign - - attr_accessor :validation_rules - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'campaign' => :'campaign', - :'validation_rules' => :'validation_rules' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'campaign' => :'String', - :'validation_rules' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentsCreateCoinRewardRequestBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentsCreateCoinRewardRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - else - self.campaign = nil - end - - if attributes.key?(:'validation_rules') - if (value = attributes[:'validation_rules']).is_a?(Array) - self.validation_rules = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @campaign.nil? - invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @campaign.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - campaign == o.campaign && - validation_rules == o.validation_rules - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [campaign, validation_rules].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body.rb b/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body.rb deleted file mode 100644 index 13140dfb..00000000 --- a/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body.rb +++ /dev/null @@ -1,239 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Request body schema for **POST** `/rewards/{rewardID}/assignments`. - class RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody - # The campaign ID of the campaign to which the reward is to be assigned. - attr_accessor :campaign - - attr_accessor :parameters - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'campaign' => :'campaign', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'campaign' => :'String', - :'parameters' => :'RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - else - self.campaign = nil - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - else - self.parameters = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @campaign.nil? - invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') - end - - if @parameters.nil? - invalid_properties.push('invalid value for "parameters", parameters cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @campaign.nil? - return false if @parameters.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - campaign == o.campaign && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [campaign, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters.rb b/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters.rb deleted file mode 100644 index 1160bd37..00000000 --- a/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the cost of the reward. - class RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters - attr_accessor :loyalty - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'loyalty' => :'loyalty' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'loyalty' => :'RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'loyalty') - self.loyalty = attributes[:'loyalty'] - else - self.loyalty = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @loyalty.nil? - invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @loyalty.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - loyalty == o.loyalty - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [loyalty].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters_loyalty.rb deleted file mode 100644 index a4ce4a52..00000000 --- a/lib/VoucherifySdk/models/reward_assignments_create_digital_or_material_reward_request_body_parameters_loyalty.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the equivalent points value of the reward. - class RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty - # Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. - attr_accessor :points - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'points' => :'points' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'points' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAssignmentsCreateDigitalOrMaterialRewardRequestBodyParametersLoyalty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'points') - self.points = attributes[:'points'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - points == o.points - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [points].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_attributes.rb b/lib/VoucherifySdk/models/reward_attributes.rb index 15ce1c86..b303d310 100644 --- a/lib/VoucherifySdk/models/reward_attributes.rb +++ b/lib/VoucherifySdk/models/reward_attributes.rb @@ -46,21 +46,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'image_url', + :'description' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardAttributes` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/reward_type.rb b/lib/VoucherifySdk/models/reward_type.rb index 1bdc624d..3d9a15ea 100644 --- a/lib/VoucherifySdk/models/reward_type.rb +++ b/lib/VoucherifySdk/models/reward_type.rb @@ -14,93 +14,215 @@ require 'time' module VoucherifySdk - module RewardType - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'RewardTypeCampaign', - :'RewardTypeCoin', - :'RewardTypeMaterial' - ] + class RewardType + attr_accessor :campaign + + attr_accessor :coin + + attr_accessor :product + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign' => :'campaign', + :'coin' => :'coin', + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign' => :'RewardTypeCampaign', + :'coin' => :'RewardTypeCoin', + :'product' => :'RewardTypeProduct' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign', + :'coin', + :'product' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] end - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end + if attributes.key?(:'coin') + self.coin = attributes[:'coin'] + end - openapi_one_of.include?(:AnyType) ? data : nil + if attributes.key?(:'product') + self.product = attributes[:'product'] end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign == o.campaign && + coin == o.coin && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign, coin, product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/reward_type_campaign.rb b/lib/VoucherifySdk/models/reward_type_campaign.rb index e94a811d..856b7fec 100644 --- a/lib/VoucherifySdk/models/reward_type_campaign.rb +++ b/lib/VoucherifySdk/models/reward_type_campaign.rb @@ -14,13 +14,45 @@ require 'time' module VoucherifySdk + # Objects stores information about the campaign related to the reward. class RewardTypeCampaign - attr_accessor :campaign + # Unique campaign ID, assigned by Voucherify. + attr_accessor :id + + # The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card. For gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Campaign type. + attr_accessor :type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'campaign' => :'campaign' + :'id' => :'id', + :'balance' => :'balance', + :'type' => :'type' } end @@ -32,35 +64,39 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'campaign' => :'RewardTypeCampaignCampaign' + :'id' => :'String', + :'balance' => :'Integer', + :'type' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'balance', + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardTypeCampaign` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardTypeCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - else - self.campaign = nil + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] end end @@ -69,10 +105,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @campaign.nil? - invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') - end - invalid_properties end @@ -80,7 +112,8 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @campaign.nil? + type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_COUPONS", "GIFT_VOUCHERS", "LOYALTY_PROGRAM"]) + return false unless type_validator.valid?(@type) true end @@ -89,7 +122,9 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - campaign == o.campaign + id == o.id && + balance == o.balance && + type == o.type end # @see the `==` method @@ -101,7 +136,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [campaign].hash + [id, balance, type].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/reward_type_campaign_campaign.rb b/lib/VoucherifySdk/models/reward_type_campaign_campaign.rb deleted file mode 100644 index 948b97d4..00000000 --- a/lib/VoucherifySdk/models/reward_type_campaign_campaign.rb +++ /dev/null @@ -1,284 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Objects stores information about the campaign related to the reward. - class RewardTypeCampaignCampaign - # Unique campaign ID, assigned by Voucherify. - attr_accessor :id - - # The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. - attr_accessor :balance - - # Campaign type. - attr_accessor :type - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'balance' => :'balance', - :'type' => :'type' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'balance' => :'Integer', - :'type' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardTypeCampaignCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardTypeCampaignCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'balance') - self.balance = attributes[:'balance'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_COUPONS", "PROMOTION", "GIFT_VOUCHERS", "REFERRAL_PROGRAM", "LOYALTY_PROGRAM"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["DISCOUNT_COUPONS", "PROMOTION", "GIFT_VOUCHERS", "REFERRAL_PROGRAM", "LOYALTY_PROGRAM"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - balance == o.balance && - type == o.type - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, balance, type].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_type_coin.rb b/lib/VoucherifySdk/models/reward_type_coin.rb index 11b17de0..bea38b79 100644 --- a/lib/VoucherifySdk/models/reward_type_coin.rb +++ b/lib/VoucherifySdk/models/reward_type_coin.rb @@ -14,13 +14,19 @@ require 'time' module VoucherifySdk + # Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio. class RewardTypeCoin - attr_accessor :coin + # The cash equivalent of the points defined in the points_ratio property. + attr_accessor :exchange_ratio + + # The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. + attr_accessor :points_ratio # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'coin' => :'coin' + :'exchange_ratio' => :'exchange_ratio', + :'points_ratio' => :'points_ratio' } end @@ -32,35 +38,33 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'coin' => :'RewardTypeCoinCoin' + :'exchange_ratio' => :'Float', + :'points_ratio' => :'Integer' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'exchange_ratio', + :'points_ratio' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardTypeCoin` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardTypeCoin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } - if attributes.key?(:'coin') - self.coin = attributes[:'coin'] - else - self.coin = nil + if attributes.key?(:'exchange_ratio') + self.exchange_ratio = attributes[:'exchange_ratio'] + end + + if attributes.key?(:'points_ratio') + self.points_ratio = attributes[:'points_ratio'] end end @@ -69,10 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @coin.nil? - invalid_properties.push('invalid value for "coin", coin cannot be nil.') - end - invalid_properties end @@ -80,7 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @coin.nil? true end @@ -89,7 +88,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - coin == o.coin + exchange_ratio == o.exchange_ratio && + points_ratio == o.points_ratio end # @see the `==` method @@ -101,7 +101,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [coin].hash + [exchange_ratio, points_ratio].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/reward_type_coin_coin.rb b/lib/VoucherifySdk/models/reward_type_coin_coin.rb deleted file mode 100644 index cf9d077e..00000000 --- a/lib/VoucherifySdk/models/reward_type_coin_coin.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio. - class RewardTypeCoinCoin - # The cash equivalent of the points defined in the points_ratio property. - attr_accessor :exchange_ratio - - # The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. - attr_accessor :points_ratio - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'exchange_ratio' => :'exchange_ratio', - :'points_ratio' => :'points_ratio' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'exchange_ratio' => :'Float', - :'points_ratio' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardTypeCoinCoin` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardTypeCoinCoin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'exchange_ratio') - self.exchange_ratio = attributes[:'exchange_ratio'] - else - self.exchange_ratio = nil - end - - if attributes.key?(:'points_ratio') - self.points_ratio = attributes[:'points_ratio'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @exchange_ratio.nil? - invalid_properties.push('invalid value for "exchange_ratio", exchange_ratio cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @exchange_ratio.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - exchange_ratio == o.exchange_ratio && - points_ratio == o.points_ratio - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [exchange_ratio, points_ratio].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_type_material.rb b/lib/VoucherifySdk/models/reward_type_material.rb deleted file mode 100644 index 7975d8e0..00000000 --- a/lib/VoucherifySdk/models/reward_type_material.rb +++ /dev/null @@ -1,221 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class RewardTypeMaterial - attr_accessor :product - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'product' => :'product' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'product' => :'RewardTypeMaterialProduct' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardTypeMaterial` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardTypeMaterial`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'product') - self.product = attributes[:'product'] - else - self.product = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @product.nil? - invalid_properties.push('invalid value for "product", product cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @product.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - product == o.product - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [product].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_type_material_product.rb b/lib/VoucherifySdk/models/reward_type_material_product.rb deleted file mode 100644 index 5ff1f8d5..00000000 --- a/lib/VoucherifySdk/models/reward_type_material_product.rb +++ /dev/null @@ -1,236 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains information about the product given as a reward. - class RewardTypeMaterialProduct - # Unique product ID, assigned by Voucherify. - attr_accessor :id - - # Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. - attr_accessor :sku_id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'sku_id' => :'sku_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'sku_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'sku_id' - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardTypeMaterialProduct` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardTypeMaterialProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'sku_id') - self.sku_id = attributes[:'sku_id'] - else - self.sku_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - sku_id == o.sku_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, sku_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/reward_type_product.rb b/lib/VoucherifySdk/models/reward_type_product.rb new file mode 100644 index 00000000..1cfc826b --- /dev/null +++ b/lib/VoucherifySdk/models/reward_type_product.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the product given as a reward. + class RewardTypeProduct + # Unique product ID, assigned by Voucherify. + attr_accessor :id + + # Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. + attr_accessor :sku_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'sku_id' => :'sku_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'sku_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'sku_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'sku_id') + self.sku_id = attributes[:'sku_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + sku_id == o.sku_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, sku_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_create_request_body.rb b/lib/VoucherifySdk/models/rewards_assignments_create_request_body.rb index 3c8ac1fa..945a60fd 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_create_request_body.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_create_request_body.rb @@ -14,93 +14,218 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/rewards/{rewardID}/assignments`. - module RewardsAssignmentsCreateRequestBody - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'RewardAssignmentsCreateCoinRewardRequestBody', - :'RewardAssignmentsCreateDigitalOrMaterialRewardRequestBody' - ] + class RewardsAssignmentsCreateRequestBody + # The campaign ID of the campaign to which the reward is to be assigned. + attr_accessor :campaign + + attr_accessor :parameters + + attr_accessor :validation_rules + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign' => :'campaign', + :'parameters' => :'parameters', + :'validation_rules' => :'validation_rules' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign' => :'String', + :'parameters' => :'RewardsAssignmentsCreateRequestBodyParameters', + :'validation_rules' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign', + :'parameters', + :'validation_rules' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] end - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end - openapi_one_of.include?(:AnyType) ? data : nil + if attributes.key?(:'validation_rules') + if (value = attributes[:'validation_rules']).is_a?(Array) + self.validation_rules = value + end end + end - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign == o.campaign && + parameters == o.parameters && + validation_rules == o.validation_rules + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign, parameters, validation_rules].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) end + hash end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end end diff --git a/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters.rb b/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters.rb new file mode 100644 index 00000000..053c50ae --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class RewardsAssignmentsCreateRequestBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'RewardsAssignmentsCreateRequestBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters_loyalty.rb new file mode 100644 index 00000000..5e4f313f --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters_loyalty.rb @@ -0,0 +1,215 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class RewardsAssignmentsCreateRequestBodyParametersLoyalty + # Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@points.nil? && @points < 1 + invalid_properties.push('invalid value for "points", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@points.nil? && @points < 1 + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_create_response_body.rb b/lib/VoucherifySdk/models/rewards_assignments_create_response_body.rb index d3d08d3d..e6113022 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_create_response_body.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/rewards/{rewardId}/assignments/{assignmentId}`. + # Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. class RewardsAssignmentsCreateResponseBody # Unique reward assignment ID, assigned by Voucherify. attr_accessor :id @@ -22,13 +22,13 @@ class RewardsAssignmentsCreateResponseBody # Associated reward ID. attr_accessor :reward_id - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward assignment. + # The type of the object represented by the JSON. This object stores information about the reward assignment. attr_accessor :object # Related object ID to which the reward was assigned. @@ -90,61 +90,46 @@ def self.openapi_types :'object' => :'String', :'related_object_id' => :'String', :'related_object_type' => :'String', - :'parameters' => :'RewardAssignmentParametersParameters' + :'parameters' => :'RewardsAssignmentsCreateResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'reward_id', + :'created_at', :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RewardAssignment' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'reward_id') self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -155,8 +140,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') @@ -175,30 +158,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - invalid_properties end @@ -206,39 +165,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) return false unless related_object_type_validator.valid?(@related_object_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters.rb b/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters.rb new file mode 100644 index 00000000..35df1bb3 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class RewardsAssignmentsCreateResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'RewardsAssignmentsCreateResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..2c713ea6 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class RewardsAssignmentsCreateResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_get_response_body.rb b/lib/VoucherifySdk/models/rewards_assignments_get_response_body.rb index ca265766..4298677a 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_get_response_body.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/rewards/{rewardId}/assignments/{assignmentId}`. + # Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. class RewardsAssignmentsGetResponseBody # Unique reward assignment ID, assigned by Voucherify. attr_accessor :id @@ -22,13 +22,13 @@ class RewardsAssignmentsGetResponseBody # Associated reward ID. attr_accessor :reward_id - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward assignment. + # The type of the object represented by the JSON. This object stores information about the reward assignment. attr_accessor :object # Related object ID to which the reward was assigned. @@ -90,61 +90,46 @@ def self.openapi_types :'object' => :'String', :'related_object_id' => :'String', :'related_object_type' => :'String', - :'parameters' => :'RewardAssignmentParametersParameters' + :'parameters' => :'RewardsAssignmentsGetResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'reward_id', + :'created_at', :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RewardAssignment' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'reward_id') self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -155,8 +140,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') @@ -175,30 +158,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - invalid_properties end @@ -206,39 +165,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) return false unless related_object_type_validator.valid?(@related_object_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters.rb b/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters.rb new file mode 100644 index 00000000..eb9b6d4f --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class RewardsAssignmentsGetResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'RewardsAssignmentsGetResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..c66d3e72 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class RewardsAssignmentsGetResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_list_response_body.rb b/lib/VoucherifySdk/models/rewards_assignments_list_response_body.rb index 9633e2ec..755eea82 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_list_response_body.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/rewards/{rewardID}/assignments`. + # Response body schema for **GET** `v1/rewards/{rewardID}/assignments`. class RewardsAssignmentsListResponseBody - # The type of object represented by JSON. This object stores information about reward assignments in a dictionary. + # The type of the object represented by JSON. This object stores information about reward assignments in a dictionary. attr_accessor :object # Identifies the name of the attribute that contains the array of reward assignments. @@ -55,21 +55,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -89,14 +86,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -105,22 +98,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -128,10 +105,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/rewards_assignments_update_request_body.rb b/lib/VoucherifySdk/models/rewards_assignments_update_request_body.rb index e2839efc..333db8ac 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_update_request_body.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **PUT** `/loyalties/{campaignId}/rewards/{assignmentId}` and **PUT** `/rewards/{rewardId}/assignments/{assignmentId}`. + # Request body schema for **PUT** `v1/rewards/{rewardId}/assignments/{assignmentId}`. class RewardsAssignmentsUpdateRequestBody attr_accessor :parameters @@ -40,21 +40,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'parameters' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters.rb b/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters.rb index fcd75dd2..f3076076 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters.rb @@ -40,21 +40,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'loyalty' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsUpdateRequestBodyParameters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsUpdateRequestBodyParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters_loyalty.rb index a4a17a06..b7637b13 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters_loyalty.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters_loyalty.rb @@ -41,21 +41,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsUpdateRequestBodyParametersLoyalty` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsUpdateRequestBodyParametersLoyalty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/rewards_assignments_update_response_body.rb b/lib/VoucherifySdk/models/rewards_assignments_update_response_body.rb index a8ebe7d2..cc772b5c 100644 --- a/lib/VoucherifySdk/models/rewards_assignments_update_response_body.rb +++ b/lib/VoucherifySdk/models/rewards_assignments_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/rewards/{rewardId}/assignments/{assignmentId}`. + # Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. class RewardsAssignmentsUpdateResponseBody # Unique reward assignment ID, assigned by Voucherify. attr_accessor :id @@ -22,13 +22,13 @@ class RewardsAssignmentsUpdateResponseBody # Associated reward ID. attr_accessor :reward_id - # Timestamp representing the date and time when the reward assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format. + # Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by the JSON. This object stores information about the reward assignment. + # The type of the object represented by the JSON. This object stores information about the reward assignment. attr_accessor :object # Related object ID to which the reward was assigned. @@ -90,61 +90,46 @@ def self.openapi_types :'object' => :'String', :'related_object_id' => :'String', :'related_object_type' => :'String', - :'parameters' => :'RewardAssignmentParametersParameters' + :'parameters' => :'RewardsAssignmentsUpdateResponseBodyParameters' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'reward_id', + :'created_at', :'updated_at', + :'object', + :'related_object_id', + :'related_object_type', + :'parameters' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'RewardAssignment' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::RewardsAssignmentsUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::RewardsAssignmentsUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'reward_id') self.reward_id = attributes[:'reward_id'] - else - self.reward_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -155,8 +140,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') @@ -175,30 +158,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @reward_id.nil? - invalid_properties.push('invalid value for "reward_id", reward_id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - invalid_properties end @@ -206,39 +165,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @reward_id.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["reward_assignment"]) return false unless object_validator.valid?(@object) - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"]) return false unless related_object_type_validator.valid?(@related_object_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters.rb b/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters.rb new file mode 100644 index 00000000..ff2340f0 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the cost of the reward. + class RewardsAssignmentsUpdateResponseBodyParameters + attr_accessor :loyalty + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'loyalty' => :'loyalty' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'loyalty' => :'RewardsAssignmentsUpdateResponseBodyParametersLoyalty' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loyalty' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'loyalty') + self.loyalty = attributes[:'loyalty'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + loyalty == o.loyalty + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [loyalty].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters_loyalty.rb b/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters_loyalty.rb new file mode 100644 index 00000000..0973e533 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters_loyalty.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the equivalent points value of the reward. + class RewardsAssignmentsUpdateResponseBodyParametersLoyalty + # The number of points required to redeem the reward. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_request_body.rb b/lib/VoucherifySdk/models/rewards_create_request_body.rb new file mode 100644 index 00000000..4f575ea9 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_request_body.rb @@ -0,0 +1,250 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RewardsCreateRequestBody + # Reward name. + attr_accessor :name + + attr_accessor :parameters + + attr_accessor :metadata + + # The number of units of the product that you want to share as a reward. + attr_accessor :stock + + attr_accessor :attributes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'parameters' => :'parameters', + :'metadata' => :'metadata', + :'stock' => :'stock', + :'attributes' => :'attributes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'parameters' => :'RewardsCreateRequestBodyParameters', + :'metadata' => :'Object', + :'stock' => :'Integer', + :'attributes' => :'RewardsCreateRequestBodyAttributes' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'parameters', + :'metadata', + :'stock', + :'attributes' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'stock') + self.stock = attributes[:'stock'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + parameters == o.parameters && + metadata == o.metadata && + stock == o.stock && + attributes == o.attributes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, parameters, metadata, stock, attributes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_request_body_attributes.rb b/lib/VoucherifySdk/models/rewards_create_request_body_attributes.rb new file mode 100644 index 00000000..518d075e --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_request_body_attributes.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Attributes of a material reward. + class RewardsCreateRequestBodyAttributes + # HTTPS URL pointing to a .png or .jpg file. + attr_accessor :image_url + + # Description of a material reward. + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'image_url', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'description' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_request_body_parameters.rb b/lib/VoucherifySdk/models/rewards_create_request_body_parameters.rb new file mode 100644 index 00000000..1d3d70a5 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_request_body_parameters.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RewardsCreateRequestBodyParameters + attr_accessor :campaign + + attr_accessor :product + + attr_accessor :coin + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign' => :'campaign', + :'product' => :'product', + :'coin' => :'coin' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign' => :'RewardsCreateRequestBodyParametersCampaign', + :'product' => :'RewardsCreateRequestBodyParametersProduct', + :'coin' => :'RewardsCreateRequestBodyParametersCoin' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign', + :'product', + :'coin' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'coin') + self.coin = attributes[:'coin'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign == o.campaign && + product == o.product && + coin == o.coin + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign, product, coin].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_request_body_parameters_campaign.rb b/lib/VoucherifySdk/models/rewards_create_request_body_parameters_campaign.rb new file mode 100644 index 00000000..28334bcb --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_request_body_parameters_campaign.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RewardsCreateRequestBodyParametersCampaign + attr_accessor :id + + # The incremental points to be added to the current balance on the loyalty card. and The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'balance' => :'balance' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'balance' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'balance' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + balance == o.balance + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, balance].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_request_body_parameters_coin.rb b/lib/VoucherifySdk/models/rewards_create_request_body_parameters_coin.rb new file mode 100644 index 00000000..5d7668af --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_request_body_parameters_coin.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + class RewardsCreateRequestBodyParametersCoin + # The cash equivalent of the points defined in the `points_ratio` property. + attr_accessor :exchange_ratio + + # The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. + attr_accessor :points_ratio + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'exchange_ratio' => :'exchange_ratio', + :'points_ratio' => :'points_ratio' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'exchange_ratio' => :'String', + :'points_ratio' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'exchange_ratio', + :'points_ratio' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'exchange_ratio') + self.exchange_ratio = attributes[:'exchange_ratio'] + end + + if attributes.key?(:'points_ratio') + self.points_ratio = attributes[:'points_ratio'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + exchange_ratio == o.exchange_ratio && + points_ratio == o.points_ratio + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [exchange_ratio, points_ratio].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_request_body_parameters_product.rb b/lib/VoucherifySdk/models/rewards_create_request_body_parameters_product.rb new file mode 100644 index 00000000..676b0f3d --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_request_body_parameters_product.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Define the product given as a reward. + class RewardsCreateRequestBodyParametersProduct + # Unique product ID, assigned by Voucherify, given as a reward. + attr_accessor :id + + # Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. + attr_accessor :sku_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'sku_id' => :'sku_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'sku_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'sku_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'sku_id') + self.sku_id = attributes[:'sku_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + sku_id == o.sku_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, sku_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_response_body.rb b/lib/VoucherifySdk/models/rewards_create_response_body.rb new file mode 100644 index 00000000..a7254407 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_response_body.rb @@ -0,0 +1,349 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/rewards`. + class RewardsCreateResponseBody + # Unique reward ID, assigned by Voucherify. + attr_accessor :id + + # Reward name. + attr_accessor :name + + # Configurable for **material rewards**. The number of units of the product that you want to share as reward. + attr_accessor :stock + + # Defines the number of already invoked (successful) reward redemptions. + attr_accessor :redeemed + + attr_accessor :attributes + + # 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. + attr_accessor :metadata + + # Reward type. + attr_accessor :type + + attr_accessor :parameters + + # Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # The type of the object represented by the JSON. This object stores information about the reward. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'stock' => :'stock', + :'redeemed' => :'redeemed', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'type' => :'type', + :'parameters' => :'parameters', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'stock' => :'Integer', + :'redeemed' => :'Integer', + :'attributes' => :'RewardsCreateResponseBodyAttributes', + :'metadata' => :'Object', + :'type' => :'String', + :'parameters' => :'RewardType', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'stock', + :'redeemed', + :'attributes', + :'metadata', + :'type', + :'created_at', + :'updated_at', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'stock') + self.stock = attributes[:'stock'] + end + + if attributes.key?(:'redeemed') + self.redeemed = attributes[:'redeemed'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'reward' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) + return false unless type_validator.valid?(@type) + return false if @object.nil? + object_validator = EnumAttributeValidator.new('String', ["reward"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + stock == o.stock && + redeemed == o.redeemed && + attributes == o.attributes && + metadata == o.metadata && + type == o.type && + parameters == o.parameters && + created_at == o.created_at && + updated_at == o.updated_at && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, stock, redeemed, attributes, metadata, type, parameters, created_at, updated_at, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_create_response_body_attributes.rb b/lib/VoucherifySdk/models/rewards_create_response_body_attributes.rb new file mode 100644 index 00000000..bb494251 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_create_response_body_attributes.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # These properties are configurable for **material rewards**. + class RewardsCreateResponseBodyAttributes + # The HTTPS URL pointing to the .png or .jpg file. + attr_accessor :image_url + + # An arbitrary string that you can attach to a material reward. + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'image_url', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'description' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_list_response_body.rb b/lib/VoucherifySdk/models/rewards_list_response_body.rb new file mode 100644 index 00000000..0cc29cb5 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_list_response_body.rb @@ -0,0 +1,249 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/rewards`. + class RewardsListResponseBody + # The type of the object represented by JSON. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of transaction objects. + attr_accessor :data_ref + + # A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object. + attr_accessor :data + + # Returns how many rewards in the project meet the limits defined by the query parameter definitions. + attr_accessor :total + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'data' => :'data', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'data' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'data', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'data' + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + data == o.data && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, data, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_request_body.rb b/lib/VoucherifySdk/models/rewards_update_request_body.rb new file mode 100644 index 00000000..2e4103c0 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_request_body.rb @@ -0,0 +1,250 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RewardsUpdateRequestBody + # Reward name. + attr_accessor :name + + attr_accessor :parameters + + attr_accessor :metadata + + # The number of units of the product that you want to share as a reward. + attr_accessor :stock + + attr_accessor :attributes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'parameters' => :'parameters', + :'metadata' => :'metadata', + :'stock' => :'stock', + :'attributes' => :'attributes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'parameters' => :'RewardsUpdateRequestBodyParameters', + :'metadata' => :'Object', + :'stock' => :'Integer', + :'attributes' => :'RewardsUpdateRequestBodyAttributes' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'parameters', + :'metadata', + :'stock', + :'attributes' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'stock') + self.stock = attributes[:'stock'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + parameters == o.parameters && + metadata == o.metadata && + stock == o.stock && + attributes == o.attributes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, parameters, metadata, stock, attributes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_request_body_attributes.rb b/lib/VoucherifySdk/models/rewards_update_request_body_attributes.rb new file mode 100644 index 00000000..cdf6d6b7 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_request_body_attributes.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Attributes of a material reward. + class RewardsUpdateRequestBodyAttributes + # HTTPS URL pointing to a .png or .jpg file. + attr_accessor :image_url + + # Description of a material reward. + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'image_url', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'description' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_request_body_parameters.rb b/lib/VoucherifySdk/models/rewards_update_request_body_parameters.rb new file mode 100644 index 00000000..afc0091c --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_request_body_parameters.rb @@ -0,0 +1,228 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RewardsUpdateRequestBodyParameters + attr_accessor :campaign + + attr_accessor :product + + attr_accessor :coin + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign' => :'campaign', + :'product' => :'product', + :'coin' => :'coin' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign' => :'RewardsUpdateRequestBodyParametersCampaign', + :'product' => :'RewardsUpdateRequestBodyParametersProduct', + :'coin' => :'RewardsUpdateRequestBodyParametersCoin' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign', + :'product', + :'coin' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'coin') + self.coin = attributes[:'coin'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign == o.campaign && + product == o.product && + coin == o.coin + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign, product, coin].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_request_body_parameters_campaign.rb b/lib/VoucherifySdk/models/rewards_update_request_body_parameters_campaign.rb new file mode 100644 index 00000000..83cd9301 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_request_body_parameters_campaign.rb @@ -0,0 +1,219 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class RewardsUpdateRequestBodyParametersCampaign + attr_accessor :id + + # The incremental points to be added to the current balance on the loyalty card. and The incremental amount to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'balance' => :'balance' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'balance' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'balance' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + balance == o.balance + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, balance].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_request_body_parameters_coin.rb b/lib/VoucherifySdk/models/rewards_update_request_body_parameters_coin.rb new file mode 100644 index 00000000..1f2db945 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_request_body_parameters_coin.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + class RewardsUpdateRequestBodyParametersCoin + # The cash equivalent of the points defined in the `points_ratio` property. + attr_accessor :exchange_ratio + + # The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. + attr_accessor :points_ratio + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'exchange_ratio' => :'exchange_ratio', + :'points_ratio' => :'points_ratio' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'exchange_ratio' => :'String', + :'points_ratio' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'exchange_ratio', + :'points_ratio' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'exchange_ratio') + self.exchange_ratio = attributes[:'exchange_ratio'] + end + + if attributes.key?(:'points_ratio') + self.points_ratio = attributes[:'points_ratio'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + exchange_ratio == o.exchange_ratio && + points_ratio == o.points_ratio + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [exchange_ratio, points_ratio].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_request_body_parameters_product.rb b/lib/VoucherifySdk/models/rewards_update_request_body_parameters_product.rb new file mode 100644 index 00000000..ceb8bc8b --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_request_body_parameters_product.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Define the product given as a reward. + class RewardsUpdateRequestBodyParametersProduct + # Unique product ID, assigned by Voucherify, given as a reward. + attr_accessor :id + + # Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. + attr_accessor :sku_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'sku_id' => :'sku_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'sku_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'sku_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'sku_id') + self.sku_id = attributes[:'sku_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + sku_id == o.sku_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, sku_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_response_body.rb b/lib/VoucherifySdk/models/rewards_update_response_body.rb new file mode 100644 index 00000000..ad1ec01c --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_response_body.rb @@ -0,0 +1,349 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `v1/rewards/{rewardId}`. + class RewardsUpdateResponseBody + # Unique reward ID, assigned by Voucherify. + attr_accessor :id + + # Reward name. + attr_accessor :name + + # Configurable for **material rewards**. The number of units of the product that you want to share as reward. + attr_accessor :stock + + # Defines the number of already invoked (successful) reward redemptions. + attr_accessor :redeemed + + attr_accessor :attributes + + # 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. + attr_accessor :metadata + + # Reward type. + attr_accessor :type + + attr_accessor :parameters + + # Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + # The type of the object represented by the JSON. This object stores information about the reward. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'stock' => :'stock', + :'redeemed' => :'redeemed', + :'attributes' => :'attributes', + :'metadata' => :'metadata', + :'type' => :'type', + :'parameters' => :'parameters', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'stock' => :'Integer', + :'redeemed' => :'Integer', + :'attributes' => :'RewardsUpdateResponseBodyAttributes', + :'metadata' => :'Object', + :'type' => :'String', + :'parameters' => :'RewardType', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'stock', + :'redeemed', + :'attributes', + :'metadata', + :'type', + :'created_at', + :'updated_at', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'stock') + self.stock = attributes[:'stock'] + end + + if attributes.key?(:'redeemed') + self.redeemed = attributes[:'redeemed'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'reward' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) + return false unless type_validator.valid?(@type) + return false if @object.nil? + object_validator = EnumAttributeValidator.new('String', ["reward"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + stock == o.stock && + redeemed == o.redeemed && + attributes == o.attributes && + metadata == o.metadata && + type == o.type && + parameters == o.parameters && + created_at == o.created_at && + updated_at == o.updated_at && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, stock, redeemed, attributes, metadata, type, parameters, created_at, updated_at, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/rewards_update_response_body_attributes.rb b/lib/VoucherifySdk/models/rewards_update_response_body_attributes.rb new file mode 100644 index 00000000..6613e117 --- /dev/null +++ b/lib/VoucherifySdk/models/rewards_update_response_body_attributes.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # These properties are configurable for **material rewards**. + class RewardsUpdateResponseBodyAttributes + # The HTTPS URL pointing to the .png or .jpg file. + attr_accessor :image_url + + # An arbitrary string that you can attach to a material reward. + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'image_url', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'description' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/schema_that_contains_unique_properties_for_promotion_campaign_promotion.rb b/lib/VoucherifySdk/models/schema_that_contains_unique_properties_for_promotion_campaign_promotion.rb deleted file mode 100644 index 1257eb55..00000000 --- a/lib/VoucherifySdk/models/schema_that_contains_unique_properties_for_promotion_campaign_promotion.rb +++ /dev/null @@ -1,217 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion - attr_accessor :tiers - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'tiers' => :'tiers' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'tiers' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'tiers' - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SchemaThatContainsUniquePropertiesForPromotionCampaignPromotion`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'tiers') - if (value = attributes[:'tiers']).is_a?(Array) - self.tiers = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - tiers == o.tiers - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [tiers].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/segments_create_request_body.rb b/lib/VoucherifySdk/models/segments_create_request_body.rb new file mode 100644 index 00000000..d6868533 --- /dev/null +++ b/lib/VoucherifySdk/models/segments_create_request_body.rb @@ -0,0 +1,267 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class SegmentsCreateRequestBody + # Segment name. + attr_accessor :name + + attr_accessor :type + + # Array of customer IDs. + attr_accessor :customers + + # Defines a set of criteria for an `auto-update` segment type. + attr_accessor :filter + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'type' => :'type', + :'customers' => :'customers', + :'filter' => :'filter' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'type' => :'String', + :'customers' => :'Array', + :'filter' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'type', + :'customers', + :'filter' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'customers') + if (value = attributes[:'customers']).is_a?(Array) + self.customers = value + end + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["static", "auto-update"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + type == o.type && + customers == o.customers && + filter == o.filter + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, type, customers, filter].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/segments_create_response_body.rb b/lib/VoucherifySdk/models/segments_create_response_body.rb new file mode 100644 index 00000000..817c456f --- /dev/null +++ b/lib/VoucherifySdk/models/segments_create_response_body.rb @@ -0,0 +1,305 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/segments`. + class SegmentsCreateResponseBody + # Unique segment ID. + attr_accessor :id + + # Segment name. + attr_accessor :name + + # Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). + attr_accessor :type + + # Defines a set of criteria for an `auto-update` segment type. + attr_accessor :filter + + attr_accessor :initial_sync_status + + # The type of the object represented by JSON. This object stores information about the customer segment. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'created_at' => :'created_at', + :'type' => :'type', + :'filter' => :'filter', + :'initial_sync_status' => :'initial_sync_status', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'created_at' => :'Time', + :'type' => :'String', + :'filter' => :'Object', + :'initial_sync_status' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'created_at', + :'type', + :'filter', + :'initial_sync_status', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'initial_sync_status') + self.initial_sync_status = attributes[:'initial_sync_status'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'segment' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["auto-update", "static"]) + return false unless type_validator.valid?(@type) + initial_sync_status_validator = EnumAttributeValidator.new('String', ["IN_PROGRESS", "DONE"]) + return false unless initial_sync_status_validator.valid?(@initial_sync_status) + object_validator = EnumAttributeValidator.new('String', ["segment"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + created_at == o.created_at && + type == o.type && + filter == o.filter && + initial_sync_status == o.initial_sync_status && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, created_at, type, filter, initial_sync_status, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/segments_get_response_body.rb b/lib/VoucherifySdk/models/segments_get_response_body.rb new file mode 100644 index 00000000..14a34bd6 --- /dev/null +++ b/lib/VoucherifySdk/models/segments_get_response_body.rb @@ -0,0 +1,305 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/v1/segments/{segmentId}`. + class SegmentsGetResponseBody + # Unique segment ID. + attr_accessor :id + + # Segment name. + attr_accessor :name + + # Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). + attr_accessor :type + + # Defines a set of criteria for an `auto-update` segment type. + attr_accessor :filter + + attr_accessor :initial_sync_status + + # The type of the object represented by JSON. This object stores information about the customer segment. + attr_accessor :object + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'created_at' => :'created_at', + :'type' => :'type', + :'filter' => :'filter', + :'initial_sync_status' => :'initial_sync_status', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'created_at' => :'Time', + :'type' => :'String', + :'filter' => :'Object', + :'initial_sync_status' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'name', + :'created_at', + :'type', + :'filter', + :'initial_sync_status', + :'object' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'initial_sync_status') + self.initial_sync_status = attributes[:'initial_sync_status'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'segment' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["auto-update", "static"]) + return false unless type_validator.valid?(@type) + initial_sync_status_validator = EnumAttributeValidator.new('String', ["IN_PROGRESS", "DONE"]) + return false unless initial_sync_status_validator.valid?(@initial_sync_status) + object_validator = EnumAttributeValidator.new('String', ["segment"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + created_at == o.created_at && + type == o.type && + filter == o.filter && + initial_sync_status == o.initial_sync_status && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, created_at, type, filter, initial_sync_status, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/session.rb b/lib/VoucherifySdk/models/session.rb index e0d5f8cf..86408c57 100644 --- a/lib/VoucherifySdk/models/session.rb +++ b/lib/VoucherifySdk/models/session.rb @@ -18,7 +18,7 @@ class Session # The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. attr_accessor :key - # This parameter is required to establish a new session. The session locks the redemption quantity by 1. + # This parameter is required to establish a new session. attr_accessor :type # Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter. @@ -77,28 +77,23 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'key', + :'type', + :'ttl', + :'ttl_unit' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Session` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Session`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'key') self.key = attributes[:'key'] - else - self.key = 'LOCK' end if attributes.key?(:'type') @@ -128,8 +123,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - key_validator = EnumAttributeValidator.new('String', ["LOCK"]) - return false unless key_validator.valid?(@key) type_validator = EnumAttributeValidator.new('String', ["LOCK"]) return false unless type_validator.valid?(@type) ttl_unit_validator = EnumAttributeValidator.new('String', ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"]) @@ -137,36 +130,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] key Object to be assigned - def key=(key) - validator = EnumAttributeValidator.new('String', ["LOCK"]) - unless validator.valid?(key) - fail ArgumentError, "invalid value for \"key\", must be one of #{validator.allowable_values}." - end - @key = key - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["LOCK"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] ttl_unit Object to be assigned - def ttl_unit=(ttl_unit) - validator = EnumAttributeValidator.new('String', ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"]) - unless validator.valid?(ttl_unit) - fail ArgumentError, "invalid value for \"ttl_unit\", must be one of #{validator.allowable_values}." - end - @ttl_unit = ttl_unit - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/simple_campaign.rb b/lib/VoucherifySdk/models/simple_campaign.rb deleted file mode 100644 index 33fedfd2..00000000 --- a/lib/VoucherifySdk/models/simple_campaign.rb +++ /dev/null @@ -1,381 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Request body schema for creating a discount voucher campaign using **POST** `/campaigns`. - class SimpleCampaign - # Campaign name. - attr_accessor :id - - # Campaign name. - attr_accessor :name - - # Type of campaign. - attr_accessor :campaign_type - - # Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. - attr_accessor :type - - # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. - attr_accessor :is_referral_code - - attr_accessor :voucher - - attr_accessor :lucky_draw - - attr_accessor :referral_program - - # Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. - attr_accessor :auto_join - - # If this value is set to `true`, customers will be able to join the campaign only once. - attr_accessor :join_once - - # Indicates whether campaign is active - attr_accessor :active - - # Timestamp representing the date and time when the campaign was created in ISO 8601 format. - attr_accessor :created_at - - # The type of object represented by JSON. This object stores information about the campaign. - attr_accessor :object - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'name' => :'name', - :'campaign_type' => :'campaign_type', - :'type' => :'type', - :'is_referral_code' => :'is_referral_code', - :'voucher' => :'voucher', - :'lucky_draw' => :'lucky_draw', - :'referral_program' => :'referral_program', - :'auto_join' => :'auto_join', - :'join_once' => :'join_once', - :'active' => :'active', - :'created_at' => :'created_at', - :'object' => :'object' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'name' => :'String', - :'campaign_type' => :'String', - :'type' => :'String', - :'is_referral_code' => :'Boolean', - :'voucher' => :'Object', - :'lucky_draw' => :'Object', - :'referral_program' => :'ReferralProgram', - :'auto_join' => :'Boolean', - :'join_once' => :'Boolean', - :'active' => :'Boolean', - :'created_at' => :'Time', - :'object' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'campaign_type') - self.campaign_type = attributes[:'campaign_type'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'is_referral_code') - self.is_referral_code = attributes[:'is_referral_code'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'lucky_draw') - self.lucky_draw = attributes[:'lucky_draw'] - end - - if attributes.key?(:'referral_program') - self.referral_program = attributes[:'referral_program'] - end - - if attributes.key?(:'auto_join') - self.auto_join = attributes[:'auto_join'] - end - - if attributes.key?(:'join_once') - self.join_once = attributes[:'join_once'] - end - - if attributes.key?(:'active') - self.active = attributes[:'active'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'campaign' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - return false unless type_validator.valid?(@type) - object_validator = EnumAttributeValidator.new('String', ["campaign"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["AUTO_UPDATE", "STATIC"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["campaign"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - name == o.name && - campaign_type == o.campaign_type && - type == o.type && - is_referral_code == o.is_referral_code && - voucher == o.voucher && - lucky_draw == o.lucky_draw && - referral_program == o.referral_program && - auto_join == o.auto_join && - join_once == o.join_once && - active == o.active && - created_at == o.created_at && - object == o.object - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, name, campaign_type, type, is_referral_code, voucher, lucky_draw, referral_program, auto_join, join_once, active, created_at, object].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_consent.rb b/lib/VoucherifySdk/models/simple_consent.rb deleted file mode 100644 index 74128390..00000000 --- a/lib/VoucherifySdk/models/simple_consent.rb +++ /dev/null @@ -1,273 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SimpleConsent - attr_accessor :id - - attr_accessor :name - - attr_accessor :object - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'name' => :'name', - :'object' => :'object' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'name' => :'String', - :'object' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleConsent` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleConsent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'consent' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["consent"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["consent"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - name == o.name && - object == o.object - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, name, object].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_customer.rb b/lib/VoucherifySdk/models/simple_customer.rb index a1b0a4ab..859458e4 100644 --- a/lib/VoucherifySdk/models/simple_customer.rb +++ b/lib/VoucherifySdk/models/simple_customer.rb @@ -14,23 +14,24 @@ require 'time' module VoucherifySdk + # Simplified customer data. class SimpleCustomer - # The ID of an existing customer that will be linked to redemption in this request. + # Unique identifier of an existing customer. It is assigned by Voucherify. attr_accessor :id - # A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. - attr_accessor :source_id - # Customer's first and last name. attr_accessor :name # Customer's email address. attr_accessor :email - # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + # A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + attr_accessor :source_id + + # A set of custom key/value pairs that are attached to the customer. It stores all custom attributes assigned to the customer. attr_accessor :metadata - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object class EnumAttributeValidator @@ -59,9 +60,9 @@ def valid?(value) def self.attribute_map { :'id' => :'id', - :'source_id' => :'source_id', :'name' => :'name', :'email' => :'email', + :'source_id' => :'source_id', :'metadata' => :'metadata', :'object' => :'object' } @@ -76,9 +77,9 @@ def self.acceptable_attributes def self.openapi_types { :'id' => :'String', - :'source_id' => :'String', :'name' => :'String', :'email' => :'String', + :'source_id' => :'String', :'metadata' => :'Object', :'object' => :'String' } @@ -87,21 +88,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'email', + :'source_id', + :'metadata', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleCustomer` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -109,10 +109,6 @@ def initialize(attributes = {}) self.id = attributes[:'id'] end - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - if attributes.key?(:'name') self.name = attributes[:'name'] end @@ -121,6 +117,10 @@ def initialize(attributes = {}) self.email = attributes[:'email'] end + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end @@ -149,25 +149,15 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["customer"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && - source_id == o.source_id && name == o.name && email == o.email && + source_id == o.source_id && metadata == o.metadata && object == o.object end @@ -181,7 +171,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, source_id, name, email, metadata, object].hash + [id, name, email, source_id, metadata, object].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/simple_customer_required_object_type.rb b/lib/VoucherifySdk/models/simple_customer_required_object_type.rb index 0b0adf0e..296018af 100644 --- a/lib/VoucherifySdk/models/simple_customer_required_object_type.rb +++ b/lib/VoucherifySdk/models/simple_customer_required_object_type.rb @@ -19,7 +19,7 @@ class SimpleCustomerRequiredObjectType # The unique ID of a customer that is assigned by Voucherify. attr_accessor :id - # The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. + # The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. attr_accessor :source_id # Customer's first and last name. @@ -31,7 +31,7 @@ class SimpleCustomerRequiredObjectType # A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. attr_accessor :metadata - # The type of object represented by the JSON. This object stores information about the customer. + # The type of the object represented by the JSON. This object stores information about the customer. attr_accessor :object # Attribute mapping from ruby-style variable name to JSON key. @@ -66,21 +66,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name', + :'email', + :'metadata', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleCustomerRequiredObjectType` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleCustomerRequiredObjectType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -116,10 +115,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -127,7 +122,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? true end diff --git a/lib/VoucherifySdk/models/simple_loyalty_card.rb b/lib/VoucherifySdk/models/simple_loyalty_card.rb new file mode 100644 index 00000000..dac6655a --- /dev/null +++ b/lib/VoucherifySdk/models/simple_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Simplified loyalty card data. + class SimpleLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'String', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/simple_order.rb b/lib/VoucherifySdk/models/simple_order.rb deleted file mode 100644 index ad9cf2ec..00000000 --- a/lib/VoucherifySdk/models/simple_order.rb +++ /dev/null @@ -1,423 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Order information. - class SimpleOrder - # Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. - attr_accessor :id - - # Unique source ID of an existing order that will be linked to the redemption of this request. - attr_accessor :source_id - - # The order status. - attr_accessor :status - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - # Unique referrer ID. - attr_accessor :referrer_id - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :amount - - # Sum of all order-level discounts applied to the order. - attr_accessor :discount_amount - - # This field shows the order-level discount applied. - attr_accessor :applied_discount_amount - - # Sum of all product-specific discounts applied to the order. - attr_accessor :items_discount_amount - - # Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` - attr_accessor :items_applied_discount_amount - - # Sum of all order-level AND all product-specific discounts applied to the order. - attr_accessor :total_discount_amount - - # Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` - attr_accessor :total_applied_discount_amount - - # Order amount after undoing all the discounts through the rollback redemption. - attr_accessor :total_amount - - # Array of items applied to the order. - attr_accessor :items - - # A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. - attr_accessor :metadata - - # The type of object represented by JSON. - attr_accessor :object - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'status' => :'status', - :'customer_id' => :'customer_id', - :'referrer_id' => :'referrer_id', - :'amount' => :'amount', - :'discount_amount' => :'discount_amount', - :'applied_discount_amount' => :'applied_discount_amount', - :'items_discount_amount' => :'items_discount_amount', - :'items_applied_discount_amount' => :'items_applied_discount_amount', - :'total_discount_amount' => :'total_discount_amount', - :'total_applied_discount_amount' => :'total_applied_discount_amount', - :'total_amount' => :'total_amount', - :'items' => :'items', - :'metadata' => :'metadata', - :'object' => :'object' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'status' => :'String', - :'customer_id' => :'String', - :'referrer_id' => :'String', - :'amount' => :'Integer', - :'discount_amount' => :'Integer', - :'applied_discount_amount' => :'Integer', - :'items_discount_amount' => :'Integer', - :'items_applied_discount_amount' => :'Integer', - :'total_discount_amount' => :'Integer', - :'total_applied_discount_amount' => :'Integer', - :'total_amount' => :'Integer', - :'items' => :'Array', - :'metadata' => :'Object', - :'object' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'customer_id', - :'referrer_id', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleOrder` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - end - - if attributes.key?(:'referrer_id') - self.referrer_id = attributes[:'referrer_id'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - - if attributes.key?(:'applied_discount_amount') - self.applied_discount_amount = attributes[:'applied_discount_amount'] - end - - if attributes.key?(:'items_discount_amount') - self.items_discount_amount = attributes[:'items_discount_amount'] - end - - if attributes.key?(:'items_applied_discount_amount') - self.items_applied_discount_amount = attributes[:'items_applied_discount_amount'] - end - - if attributes.key?(:'total_discount_amount') - self.total_discount_amount = attributes[:'total_discount_amount'] - end - - if attributes.key?(:'total_applied_discount_amount') - self.total_applied_discount_amount = attributes[:'total_applied_discount_amount'] - end - - if attributes.key?(:'total_amount') - self.total_amount = attributes[:'total_amount'] - end - - if attributes.key?(:'items') - if (value = attributes[:'items']).is_a?(Array) - self.items = value - end - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - return false unless status_validator.valid?(@status) - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["order"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CREATED", "PAID", "CANCELED", "FULFILLED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - status == o.status && - customer_id == o.customer_id && - referrer_id == o.referrer_id && - amount == o.amount && - discount_amount == o.discount_amount && - applied_discount_amount == o.applied_discount_amount && - items_discount_amount == o.items_discount_amount && - items_applied_discount_amount == o.items_applied_discount_amount && - total_discount_amount == o.total_discount_amount && - total_applied_discount_amount == o.total_applied_discount_amount && - total_amount == o.total_amount && - items == o.items && - metadata == o.metadata && - object == o.object - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, status, customer_id, referrer_id, amount, discount_amount, applied_discount_amount, items_discount_amount, items_applied_discount_amount, total_discount_amount, total_applied_discount_amount, total_amount, items, metadata, object].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_order_item.rb b/lib/VoucherifySdk/models/simple_order_item.rb deleted file mode 100644 index 6669c54f..00000000 --- a/lib/VoucherifySdk/models/simple_order_item.rb +++ /dev/null @@ -1,363 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SimpleOrderItem - # The type of object represented by JSON. This object stores information about the `order_item`. - attr_accessor :object - - # The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. - attr_accessor :source_id - - # Used along with the source_id property, can be set to either sku or product. - attr_accessor :related_object - - # A unique product ID assigned by Voucherify. - attr_accessor :product_id - - # A unique SKU ID assigned by Voucherify. - attr_accessor :sku_id - - # The quantity of the particular item in the cart. - attr_accessor :quantity - - # Number of dicounted items. - attr_accessor :discount_quantity - - # The total amount of the order item (price * quantity). - attr_accessor :amount - - # Sum of all order-item-level discounts applied to the order. - attr_accessor :discount_amount - - # This field shows the order-level discount applied. - attr_accessor :applied_discount_amount - - # Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. - attr_accessor :price - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'source_id' => :'source_id', - :'related_object' => :'related_object', - :'product_id' => :'product_id', - :'sku_id' => :'sku_id', - :'quantity' => :'quantity', - :'discount_quantity' => :'discount_quantity', - :'amount' => :'amount', - :'discount_amount' => :'discount_amount', - :'applied_discount_amount' => :'applied_discount_amount', - :'price' => :'price' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'source_id' => :'String', - :'related_object' => :'String', - :'product_id' => :'String', - :'sku_id' => :'String', - :'quantity' => :'Integer', - :'discount_quantity' => :'Integer', - :'amount' => :'Integer', - :'discount_amount' => :'Integer', - :'applied_discount_amount' => :'Integer', - :'price' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleOrderItem` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleOrderItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'order_item' - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'related_object') - self.related_object = attributes[:'related_object'] - end - - if attributes.key?(:'product_id') - self.product_id = attributes[:'product_id'] - end - - if attributes.key?(:'sku_id') - self.sku_id = attributes[:'sku_id'] - end - - if attributes.key?(:'quantity') - self.quantity = attributes[:'quantity'] - end - - if attributes.key?(:'discount_quantity') - self.discount_quantity = attributes[:'discount_quantity'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'discount_amount') - self.discount_amount = attributes[:'discount_amount'] - end - - if attributes.key?(:'applied_discount_amount') - self.applied_discount_amount = attributes[:'applied_discount_amount'] - end - - if attributes.key?(:'price') - self.price = attributes[:'price'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - object_validator = EnumAttributeValidator.new('String', ["order_item"]) - return false unless object_validator.valid?(@object) - related_object_validator = EnumAttributeValidator.new('String', ["product", "sku"]) - return false unless related_object_validator.valid?(@related_object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["order_item"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object Object to be assigned - def related_object=(related_object) - validator = EnumAttributeValidator.new('String', ["product", "sku"]) - unless validator.valid?(related_object) - fail ArgumentError, "invalid value for \"related_object\", must be one of #{validator.allowable_values}." - end - @related_object = related_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - source_id == o.source_id && - related_object == o.related_object && - product_id == o.product_id && - sku_id == o.sku_id && - quantity == o.quantity && - discount_quantity == o.discount_quantity && - amount == o.amount && - discount_amount == o.discount_amount && - applied_discount_amount == o.applied_discount_amount && - price == o.price - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, source_id, related_object, product_id, sku_id, quantity, discount_quantity, amount, discount_amount, applied_discount_amount, price].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_product.rb b/lib/VoucherifySdk/models/simple_product.rb deleted file mode 100644 index 2be3a105..00000000 --- a/lib/VoucherifySdk/models/simple_product.rb +++ /dev/null @@ -1,235 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SimpleProduct - # Unique product ID. - attr_accessor :id - - # Product source id. - attr_accessor :source_id - - # Product name. - attr_accessor :name - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'name' => :'name' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'name' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleProduct` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - name == o.name - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, name].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_product_discount_unit.rb b/lib/VoucherifySdk/models/simple_product_discount_unit.rb index dfe2fb20..86a6f145 100644 --- a/lib/VoucherifySdk/models/simple_product_discount_unit.rb +++ b/lib/VoucherifySdk/models/simple_product_discount_unit.rb @@ -50,28 +50,22 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleProductDiscountUnit` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleProductDiscountUnit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') @@ -80,8 +74,6 @@ def initialize(attributes = {}) if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end end @@ -90,14 +82,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -105,8 +89,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? true end diff --git a/lib/VoucherifySdk/models/simple_promotion_tier.rb b/lib/VoucherifySdk/models/simple_promotion_tier.rb deleted file mode 100644 index eb4939dd..00000000 --- a/lib/VoucherifySdk/models/simple_promotion_tier.rb +++ /dev/null @@ -1,245 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is an object representing a simple promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone. - class SimplePromotionTier - # Unique promotion tier ID. - attr_accessor :id - - # Name of the promotion tier. - attr_accessor :name - - # Text to be displayed to your customers on your website. - attr_accessor :banner - - attr_accessor :campaign - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'name' => :'name', - :'banner' => :'banner', - :'campaign' => :'campaign' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'name' => :'String', - :'banner' => :'String', - :'campaign' => :'SimplePromotionTierCampaign' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimplePromotionTier` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimplePromotionTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'banner') - self.banner = attributes[:'banner'] - end - - if attributes.key?(:'campaign') - self.campaign = attributes[:'campaign'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - name == o.name && - banner == o.banner && - campaign == o.campaign - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, name, banner, campaign].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_promotion_tier_campaign.rb b/lib/VoucherifySdk/models/simple_promotion_tier_campaign.rb deleted file mode 100644 index 621f5554..00000000 --- a/lib/VoucherifySdk/models/simple_promotion_tier_campaign.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains details about promotion tier's parent campaign. - class SimplePromotionTierCampaign - # Unique campaign ID. - attr_accessor :id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimplePromotionTierCampaign` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimplePromotionTierCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_redemption.rb b/lib/VoucherifySdk/models/simple_redemption.rb deleted file mode 100644 index 3536e5f1..00000000 --- a/lib/VoucherifySdk/models/simple_redemption.rb +++ /dev/null @@ -1,368 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is an object representing a simple redemption. - class SimpleRedemption - # Unique redemption ID. - attr_accessor :id - - # Unique customer ID of the redeeming customer. - attr_accessor :customer_id - - # Hashed customer source ID. - attr_accessor :tracking_id - - # Timestamp representing the date and time when the redemption was created in ISO 8601 format. - attr_accessor :date - - # A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. - attr_accessor :amount - - attr_accessor :order - - attr_accessor :reward - - attr_accessor :customer - - # Redemption result. - attr_accessor :result - - attr_accessor :voucher - - attr_accessor :promotion_tier - - # Unique redemption ID of the parent redemption. - attr_accessor :redemption - - # The type of object represented by the JSON. This object stores information about the `redemption`. - attr_accessor :object - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'customer_id' => :'customer_id', - :'tracking_id' => :'tracking_id', - :'date' => :'date', - :'amount' => :'amount', - :'order' => :'order', - :'reward' => :'reward', - :'customer' => :'customer', - :'result' => :'result', - :'voucher' => :'voucher', - :'promotion_tier' => :'promotion_tier', - :'redemption' => :'redemption', - :'object' => :'object' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'customer_id' => :'String', - :'tracking_id' => :'String', - :'date' => :'Time', - :'amount' => :'Integer', - :'order' => :'SimpleOrder', - :'reward' => :'SimpleRedemptionRewardResult', - :'customer' => :'SimpleCustomer', - :'result' => :'String', - :'voucher' => :'SimpleVoucher', - :'promotion_tier' => :'SimplePromotionTier', - :'redemption' => :'String', - :'object' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'customer_id', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleRedemption` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'promotion_tier') - self.promotion_tier = attributes[:'promotion_tier'] - end - - if attributes.key?(:'redemption') - self.redemption = attributes[:'redemption'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'redemption' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - result_validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - return false unless result_validator.valid?(@result) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] result Object to be assigned - def result=(result) - validator = EnumAttributeValidator.new('String', ["SUCCESS", "FAILURE"]) - unless validator.valid?(result) - fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." - end - @result = result - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - customer_id == o.customer_id && - tracking_id == o.tracking_id && - date == o.date && - amount == o.amount && - order == o.order && - reward == o.reward && - customer == o.customer && - result == o.result && - voucher == o.voucher && - promotion_tier == o.promotion_tier && - redemption == o.redemption && - object == o.object - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, customer_id, tracking_id, date, amount, order, reward, customer, result, voucher, promotion_tier, redemption, object].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_redemption_reward_result.rb b/lib/VoucherifySdk/models/simple_redemption_reward_result.rb deleted file mode 100644 index 1286ac82..00000000 --- a/lib/VoucherifySdk/models/simple_redemption_reward_result.rb +++ /dev/null @@ -1,380 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SimpleRedemptionRewardResult - attr_accessor :customer - - # Unique reward assignment ID assigned by Voucherify. - attr_accessor :assignment_id - - attr_accessor :voucher - - attr_accessor :product - - attr_accessor :sku - - # Unique loyalty tier ID assigned by Voucherify. - attr_accessor :loyalty_tier_id - - # Unique reward ID, assigned by Voucherify. - attr_accessor :id - - # The type of object represented by the JSON. This object stores information about the reward. - attr_accessor :object - - # Reward name. - attr_accessor :name - - # Timestamp representing the date and time when the reward was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the reward was updated in ISO 8601 format. - attr_accessor :updated_at - - # Defines how the reward is generated. - attr_accessor :parameters - - # Reward type. - attr_accessor :type - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'customer' => :'customer', - :'assignment_id' => :'assignment_id', - :'voucher' => :'voucher', - :'product' => :'product', - :'sku' => :'sku', - :'loyalty_tier_id' => :'loyalty_tier_id', - :'id' => :'id', - :'object' => :'object', - :'name' => :'name', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'parameters' => :'parameters', - :'type' => :'type' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'customer' => :'SimpleCustomer', - :'assignment_id' => :'String', - :'voucher' => :'SimpleVoucher', - :'product' => :'SimpleProduct', - :'sku' => :'SimpleSku', - :'loyalty_tier_id' => :'String', - :'id' => :'String', - :'object' => :'String', - :'name' => :'String', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'parameters' => :'Object', - :'type' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'updated_at', - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleRedemptionRewardResult` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleRedemptionRewardResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'assignment_id') - self.assignment_id = attributes[:'assignment_id'] - end - - if attributes.key?(:'voucher') - self.voucher = attributes[:'voucher'] - end - - if attributes.key?(:'product') - self.product = attributes[:'product'] - end - - if attributes.key?(:'sku') - self.sku = attributes[:'sku'] - end - - if attributes.key?(:'loyalty_tier_id') - self.loyalty_tier_id = attributes[:'loyalty_tier_id'] - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'reward' - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - object_validator = EnumAttributeValidator.new('String', ["reward"]) - return false unless object_validator.valid?(@object) - type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) - return false unless type_validator.valid?(@type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["reward"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - customer == o.customer && - assignment_id == o.assignment_id && - voucher == o.voucher && - product == o.product && - sku == o.sku && - loyalty_tier_id == o.loyalty_tier_id && - id == o.id && - object == o.object && - name == o.name && - created_at == o.created_at && - updated_at == o.updated_at && - parameters == o.parameters && - type == o.type - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [customer, assignment_id, voucher, product, sku, loyalty_tier_id, id, object, name, created_at, updated_at, parameters, type].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_referral_tier.rb b/lib/VoucherifySdk/models/simple_referral_tier.rb deleted file mode 100644 index e98ce132..00000000 --- a/lib/VoucherifySdk/models/simple_referral_tier.rb +++ /dev/null @@ -1,245 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SimpleReferralTier - # Unique referral tier ID. - attr_accessor :id - - # Campaign Id. - attr_accessor :campaign_id - - # Text to be displayed to your customers on your website. - attr_accessor :banner - - # Referral tier parameters - attr_accessor :parameters - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'campaign_id' => :'campaign_id', - :'banner' => :'banner', - :'parameters' => :'parameters' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'campaign_id' => :'String', - :'banner' => :'String', - :'parameters' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleReferralTier` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleReferralTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'campaign_id') - self.campaign_id = attributes[:'campaign_id'] - end - - if attributes.key?(:'banner') - self.banner = attributes[:'banner'] - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - campaign_id == o.campaign_id && - banner == o.banner && - parameters == o.parameters - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, campaign_id, banner, parameters].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_segment.rb b/lib/VoucherifySdk/models/simple_segment.rb index 2c5b2687..f7902b35 100644 --- a/lib/VoucherifySdk/models/simple_segment.rb +++ b/lib/VoucherifySdk/models/simple_segment.rb @@ -21,7 +21,7 @@ class SimpleSegment # Segment name. attr_accessor :name - # The type of object represented by the ID. + # The type of the object represented by the ID. attr_accessor :object class EnumAttributeValidator @@ -72,34 +72,26 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleSegment` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleSegment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'object') @@ -114,18 +106,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -133,24 +113,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["segment"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["segment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/simple_sku.rb b/lib/VoucherifySdk/models/simple_sku.rb deleted file mode 100644 index a3df4ed2..00000000 --- a/lib/VoucherifySdk/models/simple_sku.rb +++ /dev/null @@ -1,235 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SimpleSku - # Unique sku ID. - attr_accessor :id - - # Sku source id. - attr_accessor :source_id - - # Sku name. - attr_accessor :sku - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'sku' => :'sku' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'sku' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleSku` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleSku`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - end - - if attributes.key?(:'sku') - self.sku = attributes[:'sku'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - sku == o.sku - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, sku].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/simple_sku_discount_unit.rb b/lib/VoucherifySdk/models/simple_sku_discount_unit.rb index 997eca37..d4d88f54 100644 --- a/lib/VoucherifySdk/models/simple_sku_discount_unit.rb +++ b/lib/VoucherifySdk/models/simple_sku_discount_unit.rb @@ -50,28 +50,22 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleSkuDiscountUnit` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleSkuDiscountUnit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') @@ -80,8 +74,6 @@ def initialize(attributes = {}) if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end end @@ -90,14 +82,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -105,8 +89,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? true end diff --git a/lib/VoucherifySdk/models/simple_voucher.rb b/lib/VoucherifySdk/models/simple_voucher.rb index 3384bc6e..95ff8528 100644 --- a/lib/VoucherifySdk/models/simple_voucher.rb +++ b/lib/VoucherifySdk/models/simple_voucher.rb @@ -14,6 +14,7 @@ require 'time' module VoucherifySdk + # Simplified voucher data. class SimpleVoucher # A unique identifier that represents the voucher assigned by Voucherify. attr_accessor :id @@ -25,13 +26,12 @@ class SimpleVoucher attr_accessor :discount - # Defines the loyalty card details. attr_accessor :loyalty_card - # Type of the object. + # Type of the voucher. attr_accessor :type - # Campaign object + # Campaign name. attr_accessor :campaign # Campaign unique ID. @@ -40,16 +40,39 @@ class SimpleVoucher # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Unique customer ID of campaign owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id - # Unique referrer ID. + # Unique identifier of the referrer assigned by Voucherify. attr_accessor :referrer_id - # Timestamp representing the date and time when the order was created in ISO 8601 format. + # Unique identifier of the category that this voucher belongs to. + attr_accessor :category_id + + # Contains details about the category. + attr_accessor :categories + + # Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher. + attr_accessor :active + + # Timestamp representing the date and time when the order was created in the ISO 8601 format. attr_accessor :created_at - # The type of object represented by JSON. + # Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + attr_accessor :updated_at + + attr_accessor :redemption + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + # A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher. + attr_accessor :metadata + + # The type of the object represented by JSON. attr_accessor :object class EnumAttributeValidator @@ -88,7 +111,15 @@ def self.attribute_map :'is_referral_code' => :'is_referral_code', :'holder_id' => :'holder_id', :'referrer_id' => :'referrer_id', + :'category_id' => :'category_id', + :'categories' => :'categories', + :'active' => :'active', :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'redemption' => :'redemption', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'metadata' => :'metadata', :'object' => :'object' } end @@ -105,14 +136,22 @@ def self.openapi_types :'code' => :'String', :'gift' => :'Gift', :'discount' => :'Discount', - :'loyalty_card' => :'Object', + :'loyalty_card' => :'SimpleLoyaltyCard', :'type' => :'String', - :'campaign' => :'Object', + :'campaign' => :'String', :'campaign_id' => :'String', :'is_referral_code' => :'Boolean', :'holder_id' => :'String', :'referrer_id' => :'String', + :'category_id' => :'String', + :'categories' => :'Array', + :'active' => :'Boolean', :'created_at' => :'Time', + :'updated_at' => :'Time', + :'redemption' => :'SimpleVoucherRedemption', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'metadata' => :'Object', :'object' => :'String' } end @@ -120,21 +159,32 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'type', + :'campaign', + :'campaign_id', + :'is_referral_code', + :'holder_id', + :'referrer_id', + :'category_id', + :'categories', + :'active', + :'created_at', + :'updated_at', + :'redemption', + :'start_date', + :'expiration_date', + :'metadata', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SimpleVoucher` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SimpleVoucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -144,8 +194,6 @@ def initialize(attributes = {}) if attributes.key?(:'code') self.code = attributes[:'code'] - else - self.code = nil end if attributes.key?(:'gift') @@ -162,8 +210,6 @@ def initialize(attributes = {}) if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = 'voucher' end if attributes.key?(:'campaign') @@ -186,10 +232,44 @@ def initialize(attributes = {}) self.referrer_id = attributes[:'referrer_id'] end + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + if attributes.key?(:'object') self.object = attributes[:'object'] else @@ -202,10 +282,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @code.nil? - invalid_properties.push('invalid value for "code", code cannot be nil.') - end - invalid_properties end @@ -213,34 +289,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @code.nil? - type_validator = EnumAttributeValidator.new('String', ["voucher"]) + type_validator = EnumAttributeValidator.new('String', ["DISCOUNT_VOUCHER", "LOYALTY_CARD", "GIFT_VOUCHER"]) return false unless type_validator.valid?(@type) object_validator = EnumAttributeValidator.new('String', ["voucher"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -257,7 +312,15 @@ def ==(o) is_referral_code == o.is_referral_code && holder_id == o.holder_id && referrer_id == o.referrer_id && + category_id == o.category_id && + categories == o.categories && + active == o.active && created_at == o.created_at && + updated_at == o.updated_at && + redemption == o.redemption && + start_date == o.start_date && + expiration_date == o.expiration_date && + metadata == o.metadata && object == o.object end @@ -270,7 +333,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, gift, discount, loyalty_card, type, campaign, campaign_id, is_referral_code, holder_id, referrer_id, created_at, object].hash + [id, code, gift, discount, loyalty_card, type, campaign, campaign_id, is_referral_code, holder_id, referrer_id, category_id, categories, active, created_at, updated_at, redemption, start_date, expiration_date, metadata, object].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/simple_voucher_redemption.rb b/lib/VoucherifySdk/models/simple_voucher_redemption.rb new file mode 100644 index 00000000..7b9e3d99 --- /dev/null +++ b/lib/VoucherifySdk/models/simple_voucher_redemption.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the redemption limits on vouchers. + class SimpleVoucherRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/sku.rb b/lib/VoucherifySdk/models/sku.rb index 188790f1..be940f4e 100644 --- a/lib/VoucherifySdk/models/sku.rb +++ b/lib/VoucherifySdk/models/sku.rb @@ -43,13 +43,13 @@ class Sku # The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the SKU was created in ISO 8601 format. + # Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the SKU was updated in ISO 8601 format. + # Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the `SKU`. + # The type of the object represented by JSON. This object stores information about the `SKU`. attr_accessor :object class EnumAttributeValidator @@ -118,58 +118,47 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'product_id', :'sku', :'price', :'currency', + :'attributes', :'image_url', + :'metadata', + :'created_at', :'updated_at', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Sku` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Sku`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] - else - self.product_id = nil end if attributes.key?(:'sku') self.sku = attributes[:'sku'] - else - self.sku = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'currency') @@ -178,32 +167,22 @@ def initialize(attributes = {}) if attributes.key?(:'attributes') self.attributes = attributes[:'attributes'] - else - self.attributes = nil end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] - else - self.image_url = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -218,30 +197,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @product_id.nil? - invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -249,27 +204,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @product_id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["sku"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/sku_with_product.rb b/lib/VoucherifySdk/models/sku_with_product.rb deleted file mode 100644 index 13851082..00000000 --- a/lib/VoucherifySdk/models/sku_with_product.rb +++ /dev/null @@ -1,433 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class SkuWithProduct - # A unique identifier that represents the SKU and is assigned by Voucherify. - attr_accessor :id - - # A unique SKU identifier from your inventory system. - attr_accessor :source_id - - # The parent product's unique ID. - attr_accessor :product_id - - # Unique user-defined SKU name. - attr_accessor :sku - - # Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. - attr_accessor :price - - # SKU price currency. - attr_accessor :currency - - # The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. - attr_accessor :attributes - - # The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. - attr_accessor :image_url - - # The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. - attr_accessor :metadata - - # Timestamp representing the date and time when the SKU was created in ISO 8601 format. - attr_accessor :created_at - - # Timestamp representing the date and time when the SKU was updated in ISO 8601 format. - attr_accessor :updated_at - - # The type of object represented by JSON. This object stores information about the `SKU`. - attr_accessor :object - - attr_accessor :product - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'source_id' => :'source_id', - :'product_id' => :'product_id', - :'sku' => :'sku', - :'price' => :'price', - :'currency' => :'currency', - :'attributes' => :'attributes', - :'image_url' => :'image_url', - :'metadata' => :'metadata', - :'created_at' => :'created_at', - :'updated_at' => :'updated_at', - :'object' => :'object', - :'product' => :'product' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'source_id' => :'String', - :'product_id' => :'String', - :'sku' => :'String', - :'price' => :'Integer', - :'currency' => :'String', - :'attributes' => :'Object', - :'image_url' => :'String', - :'metadata' => :'Object', - :'created_at' => :'Time', - :'updated_at' => :'Time', - :'object' => :'String', - :'product' => :'ProductWithoutSkus' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'source_id', - :'sku', - :'price', - :'currency', - :'image_url', - :'updated_at', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Sku' - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SkuWithProduct` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SkuWithProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'source_id') - self.source_id = attributes[:'source_id'] - else - self.source_id = nil - end - - if attributes.key?(:'product_id') - self.product_id = attributes[:'product_id'] - else - self.product_id = nil - end - - if attributes.key?(:'sku') - self.sku = attributes[:'sku'] - else - self.sku = nil - end - - if attributes.key?(:'price') - self.price = attributes[:'price'] - else - self.price = nil - end - - if attributes.key?(:'currency') - self.currency = attributes[:'currency'] - end - - if attributes.key?(:'attributes') - self.attributes = attributes[:'attributes'] - else - self.attributes = nil - end - - if attributes.key?(:'image_url') - self.image_url = attributes[:'image_url'] - else - self.image_url = nil - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - else - self.metadata = nil - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'updated_at') - self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'sku' - end - - if attributes.key?(:'product') - self.product = attributes[:'product'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @product_id.nil? - invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @product_id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @created_at.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["sku"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - source_id == o.source_id && - product_id == o.product_id && - sku == o.sku && - price == o.price && - currency == o.currency && - attributes == o.attributes && - image_url == o.image_url && - metadata == o.metadata && - created_at == o.created_at && - updated_at == o.updated_at && - object == o.object && - product == o.product - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, source_id, product_id, sku, price, currency, attributes, image_url, metadata, created_at, updated_at, object, product].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/skus_get_response_body.rb b/lib/VoucherifySdk/models/skus_get_response_body.rb index 50f4070e..d5269e45 100644 --- a/lib/VoucherifySdk/models/skus_get_response_body.rb +++ b/lib/VoucherifySdk/models/skus_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/skus/{skuId}`. + # Response body schema for **GET** `v1/skus/{skuId}`. class SkusGetResponseBody # A unique identifier that represents the SKU and is assigned by Voucherify. attr_accessor :id @@ -43,13 +43,13 @@ class SkusGetResponseBody # The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. attr_accessor :metadata - # Timestamp representing the date and time when the SKU was created in ISO 8601 format. + # Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the SKU was updated in ISO 8601 format. + # Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at - # The type of object represented by JSON. This object stores information about the `SKU`. + # The type of the object represented by JSON. This object stores information about the `SKU`. attr_accessor :object class EnumAttributeValidator @@ -118,65 +118,47 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'product_id', :'sku', :'price', :'currency', + :'attributes', :'image_url', + :'metadata', + :'created_at', :'updated_at', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Sku' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SkusGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SkusGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] - else - self.product_id = nil end if attributes.key?(:'sku') self.sku = attributes[:'sku'] - else - self.sku = nil end if attributes.key?(:'price') self.price = attributes[:'price'] - else - self.price = nil end if attributes.key?(:'currency') @@ -185,32 +167,22 @@ def initialize(attributes = {}) if attributes.key?(:'attributes') self.attributes = attributes[:'attributes'] - else - self.attributes = nil end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] - else - self.image_url = nil end if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] - else - self.metadata = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] - else - self.updated_at = nil end if attributes.key?(:'object') @@ -225,30 +197,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @product_id.nil? - invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') - end - - if @attributes.nil? - invalid_properties.push('invalid value for "attributes", attributes cannot be nil.') - end - - if @metadata.nil? - invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -256,27 +204,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @product_id.nil? - return false if @attributes.nil? - return false if @metadata.nil? - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["sku"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["sku"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/skus_import_csv_create_response_body.rb b/lib/VoucherifySdk/models/skus_import_csv_create_response_body.rb index 064e6701..8ae825b4 100644 --- a/lib/VoucherifySdk/models/skus_import_csv_create_response_body.rb +++ b/lib/VoucherifySdk/models/skus_import_csv_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/skus/importCSV`. + # Response body schema for **POST** `v1/skus/importCSV`. class SkusImportCsvCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SkusImportCsvCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SkusImportCsvCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/skus_list.rb b/lib/VoucherifySdk/models/skus_list.rb deleted file mode 100644 index 2a167e60..00000000 --- a/lib/VoucherifySdk/models/skus_list.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains information about SKUs. - class SkusList - # The type of object represented by JSON. This object stores information about SKUs. - attr_accessor :object - - # Identifies the name of the JSON property that contains the array of SKUs. - attr_accessor :data_ref - - # A dictionary that contains an array of SKUs. - attr_accessor :skus - - # Total number of SKUs in the product. - attr_accessor :total - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'object' => :'object', - :'data_ref' => :'data_ref', - :'skus' => :'skus', - :'total' => :'total' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'object' => :'String', - :'data_ref' => :'String', - :'skus' => :'Array', - :'total' => :'Integer' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SkusList` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SkusList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'list' - end - - if attributes.key?(:'data_ref') - self.data_ref = attributes[:'data_ref'] - else - self.data_ref = 'data' - end - - if attributes.key?(:'skus') - if (value = attributes[:'skus']).is_a?(Array) - self.skus = value - end - else - self.skus = nil - end - - if attributes.key?(:'total') - self.total = attributes[:'total'] - else - self.total = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @skus.nil? - invalid_properties.push('invalid value for "skus", skus cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @skus.nil? - return false if @total.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - object == o.object && - data_ref == o.data_ref && - skus == o.skus && - total == o.total - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [object, data_ref, skus, total].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/skus_list_for_product.rb b/lib/VoucherifySdk/models/skus_list_for_product.rb index c6af2bb2..e6b27d28 100644 --- a/lib/VoucherifySdk/models/skus_list_for_product.rb +++ b/lib/VoucherifySdk/models/skus_list_for_product.rb @@ -16,7 +16,7 @@ module VoucherifySdk # Contains information about child SKUs. class SkusListForProduct - # The type of object represented by JSON. This object stores information about SKUs. + # The type of the object represented by JSON. This object stores information about SKUs. attr_accessor :object # Identifies the name of the JSON property that contains the array of SKUs. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::SkusListForProduct` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::SkusListForProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/stackable_validate_redeem_base.rb b/lib/VoucherifySdk/models/stackable_validate_redeem_base.rb deleted file mode 100644 index 910f49a9..00000000 --- a/lib/VoucherifySdk/models/stackable_validate_redeem_base.rb +++ /dev/null @@ -1,299 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class StackableValidateRedeemBase - # An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. - attr_accessor :redeemables - - attr_accessor :order - - attr_accessor :customer - - attr_accessor :session - - # Is correspondent to Customer's source_id - attr_accessor :tracking_id - - # A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. - attr_accessor :metadata - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'redeemables' => :'redeemables', - :'order' => :'order', - :'customer' => :'customer', - :'session' => :'session', - :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'redeemables' => :'Array', - :'order' => :'Order', - :'customer' => :'Customer', - :'session' => :'Session', - :'tracking_id' => :'String', - :'metadata' => :'Object' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::StackableValidateRedeemBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::StackableValidateRedeemBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'redeemables') - if (value = attributes[:'redeemables']).is_a?(Array) - self.redeemables = value - end - else - self.redeemables = nil - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'customer') - self.customer = attributes[:'customer'] - end - - if attributes.key?(:'session') - self.session = attributes[:'session'] - end - - if attributes.key?(:'tracking_id') - self.tracking_id = attributes[:'tracking_id'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') - end - - if @redeemables.length > 5 - invalid_properties.push('invalid value for "redeemables", number of items must be less than or equal to 5.') - end - - if @redeemables.length < 1 - invalid_properties.push('invalid value for "redeemables", number of items must be greater than or equal to 1.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemables.nil? - return false if @redeemables.length > 5 - return false if @redeemables.length < 1 - true - end - - # Custom attribute writer method with validation - # @param [Object] redeemables Value to be assigned - def redeemables=(redeemables) - if redeemables.nil? - fail ArgumentError, 'redeemables cannot be nil' - end - - if redeemables.length > 5 - fail ArgumentError, 'invalid value for "redeemables", number of items must be less than or equal to 5.' - end - - if redeemables.length < 1 - fail ArgumentError, 'invalid value for "redeemables", number of items must be greater than or equal to 1.' - end - - @redeemables = redeemables - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - redeemables == o.redeemables && - order == o.order && - customer == o.customer && - session == o.session && - tracking_id == o.tracking_id && - metadata == o.metadata - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [redeemables, order, customer, session, tracking_id, metadata].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/stackable_validate_redeem_base_redeemables_item.rb b/lib/VoucherifySdk/models/stackable_validate_redeem_base_redeemables_item.rb deleted file mode 100644 index e40c5cfb..00000000 --- a/lib/VoucherifySdk/models/stackable_validate_redeem_base_redeemables_item.rb +++ /dev/null @@ -1,108 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module StackableValidateRedeemBaseRedeemablesItem - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'RedeemGiftCard', - :'RedeemLoyaltyCard', - :'RedeemPromotionStack', - :'RedeemPromotionTier', - :'RedeemVoucher' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/stacking_rules.rb b/lib/VoucherifySdk/models/stacking_rules.rb index ccdedc28..3aa98d7d 100644 --- a/lib/VoucherifySdk/models/stacking_rules.rb +++ b/lib/VoucherifySdk/models/stacking_rules.rb @@ -22,11 +22,14 @@ class StackingRules # Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. attr_accessor :applicable_redeemables_limit + # Defines how many redeemables per category can be applied in one request. + attr_accessor :applicable_redeemables_per_category_limit + # Defines how many redeemables with an exclusive category can be applied in one request. attr_accessor :applicable_exclusive_redeemables_limit - # Defines how many redeemables per category can be applied in one request. - attr_accessor :applicable_redeemables_per_category_limit + # Defines how many redeemables with an exclusive category per category in stacking rules can be applied in one request. + attr_accessor :applicable_exclusive_redeemables_per_category_limit # Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. attr_accessor :exclusive_categories @@ -40,6 +43,12 @@ class StackingRules # Defines redeemables sorting rule. attr_accessor :redeemables_sorting_rule + # Defines redeemables products application mode. + attr_accessor :redeemables_products_application_mode + + # Defines redeemables no effect rule. + attr_accessor :redeemables_no_effect_rule + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -67,12 +76,15 @@ def self.attribute_map { :'redeemables_limit' => :'redeemables_limit', :'applicable_redeemables_limit' => :'applicable_redeemables_limit', - :'applicable_exclusive_redeemables_limit' => :'applicable_exclusive_redeemables_limit', :'applicable_redeemables_per_category_limit' => :'applicable_redeemables_per_category_limit', + :'applicable_exclusive_redeemables_limit' => :'applicable_exclusive_redeemables_limit', + :'applicable_exclusive_redeemables_per_category_limit' => :'applicable_exclusive_redeemables_per_category_limit', :'exclusive_categories' => :'exclusive_categories', :'joint_categories' => :'joint_categories', :'redeemables_application_mode' => :'redeemables_application_mode', - :'redeemables_sorting_rule' => :'redeemables_sorting_rule' + :'redeemables_sorting_rule' => :'redeemables_sorting_rule', + :'redeemables_products_application_mode' => :'redeemables_products_application_mode', + :'redeemables_no_effect_rule' => :'redeemables_no_effect_rule' } end @@ -86,33 +98,40 @@ def self.openapi_types { :'redeemables_limit' => :'Integer', :'applicable_redeemables_limit' => :'Integer', - :'applicable_exclusive_redeemables_limit' => :'Integer', :'applicable_redeemables_per_category_limit' => :'Integer', + :'applicable_exclusive_redeemables_limit' => :'Integer', + :'applicable_exclusive_redeemables_per_category_limit' => :'Integer', :'exclusive_categories' => :'Array', :'joint_categories' => :'Array', :'redeemables_application_mode' => :'String', - :'redeemables_sorting_rule' => :'String' + :'redeemables_sorting_rule' => :'String', + :'redeemables_products_application_mode' => :'String', + :'redeemables_no_effect_rule' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'redeemables_limit', + :'applicable_redeemables_limit', + :'applicable_redeemables_per_category_limit', + :'applicable_exclusive_redeemables_limit', + :'applicable_exclusive_redeemables_per_category_limit', + :'exclusive_categories', + :'joint_categories', + :'redeemables_application_mode', + :'redeemables_sorting_rule', + :'redeemables_products_application_mode', + :'redeemables_no_effect_rule' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::StackingRules` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::StackingRules`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -128,32 +147,34 @@ def initialize(attributes = {}) self.applicable_redeemables_limit = 5 end + if attributes.key?(:'applicable_redeemables_per_category_limit') + self.applicable_redeemables_per_category_limit = attributes[:'applicable_redeemables_per_category_limit'] + else + self.applicable_redeemables_per_category_limit = 1 + end + if attributes.key?(:'applicable_exclusive_redeemables_limit') self.applicable_exclusive_redeemables_limit = attributes[:'applicable_exclusive_redeemables_limit'] else self.applicable_exclusive_redeemables_limit = 1 end - if attributes.key?(:'applicable_redeemables_per_category_limit') - self.applicable_redeemables_per_category_limit = attributes[:'applicable_redeemables_per_category_limit'] + if attributes.key?(:'applicable_exclusive_redeemables_per_category_limit') + self.applicable_exclusive_redeemables_per_category_limit = attributes[:'applicable_exclusive_redeemables_per_category_limit'] else - self.applicable_redeemables_per_category_limit = 1 + self.applicable_exclusive_redeemables_per_category_limit = 1 end if attributes.key?(:'exclusive_categories') if (value = attributes[:'exclusive_categories']).is_a?(Array) self.exclusive_categories = value end - else - self.exclusive_categories = nil end if attributes.key?(:'joint_categories') if (value = attributes[:'joint_categories']).is_a?(Array) self.joint_categories = value end - else - self.joint_categories = nil end if attributes.key?(:'redeemables_application_mode') @@ -165,6 +186,14 @@ def initialize(attributes = {}) else self.redeemables_sorting_rule = 'REQUESTED_ORDER' end + + if attributes.key?(:'redeemables_products_application_mode') + self.redeemables_products_application_mode = attributes[:'redeemables_products_application_mode'] + end + + if attributes.key?(:'redeemables_no_effect_rule') + self.redeemables_no_effect_rule = attributes[:'redeemables_no_effect_rule'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -172,56 +201,44 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemables_limit.nil? - invalid_properties.push('invalid value for "redeemables_limit", redeemables_limit cannot be nil.') - end - - if @redeemables_limit > 30 + if !@redeemables_limit.nil? && @redeemables_limit > 30 invalid_properties.push('invalid value for "redeemables_limit", must be smaller than or equal to 30.') end - if @redeemables_limit < 1 + if !@redeemables_limit.nil? && @redeemables_limit < 1 invalid_properties.push('invalid value for "redeemables_limit", must be greater than or equal to 1.') end - if @applicable_redeemables_limit.nil? - invalid_properties.push('invalid value for "applicable_redeemables_limit", applicable_redeemables_limit cannot be nil.') - end - - if @applicable_redeemables_limit > 30 + if !@applicable_redeemables_limit.nil? && @applicable_redeemables_limit > 30 invalid_properties.push('invalid value for "applicable_redeemables_limit", must be smaller than or equal to 30.') end - if @applicable_redeemables_limit < 1 + if !@applicable_redeemables_limit.nil? && @applicable_redeemables_limit < 1 invalid_properties.push('invalid value for "applicable_redeemables_limit", must be greater than or equal to 1.') end - if @applicable_exclusive_redeemables_limit.nil? - invalid_properties.push('invalid value for "applicable_exclusive_redeemables_limit", applicable_exclusive_redeemables_limit cannot be nil.') + if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit > 5 + invalid_properties.push('invalid value for "applicable_redeemables_per_category_limit", must be smaller than or equal to 5.') end - if @applicable_exclusive_redeemables_limit > 30 - invalid_properties.push('invalid value for "applicable_exclusive_redeemables_limit", must be smaller than or equal to 30.') - end - - if @applicable_exclusive_redeemables_limit < 1 - invalid_properties.push('invalid value for "applicable_exclusive_redeemables_limit", must be greater than or equal to 1.') + if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit < 1 + invalid_properties.push('invalid value for "applicable_redeemables_per_category_limit", must be greater than or equal to 1.') end - if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit > 30 - invalid_properties.push('invalid value for "applicable_redeemables_per_category_limit", must be smaller than or equal to 30.') + if !@applicable_exclusive_redeemables_limit.nil? && @applicable_exclusive_redeemables_limit > 5 + invalid_properties.push('invalid value for "applicable_exclusive_redeemables_limit", must be smaller than or equal to 5.') end - if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit < 1 - invalid_properties.push('invalid value for "applicable_redeemables_per_category_limit", must be greater than or equal to 1.') + if !@applicable_exclusive_redeemables_limit.nil? && @applicable_exclusive_redeemables_limit < 1 + invalid_properties.push('invalid value for "applicable_exclusive_redeemables_limit", must be greater than or equal to 1.') end - if @exclusive_categories.nil? - invalid_properties.push('invalid value for "exclusive_categories", exclusive_categories cannot be nil.') + if !@applicable_exclusive_redeemables_per_category_limit.nil? && @applicable_exclusive_redeemables_per_category_limit > 5 + invalid_properties.push('invalid value for "applicable_exclusive_redeemables_per_category_limit", must be smaller than or equal to 5.') end - if @joint_categories.nil? - invalid_properties.push('invalid value for "joint_categories", joint_categories cannot be nil.') + if !@applicable_exclusive_redeemables_per_category_limit.nil? && @applicable_exclusive_redeemables_per_category_limit < 1 + invalid_properties.push('invalid value for "applicable_exclusive_redeemables_per_category_limit", must be greater than or equal to 1.') end invalid_properties @@ -231,118 +248,27 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemables_limit.nil? - return false if @redeemables_limit > 30 - return false if @redeemables_limit < 1 - return false if @applicable_redeemables_limit.nil? - return false if @applicable_redeemables_limit > 30 - return false if @applicable_redeemables_limit < 1 - return false if @applicable_exclusive_redeemables_limit.nil? - return false if @applicable_exclusive_redeemables_limit > 30 - return false if @applicable_exclusive_redeemables_limit < 1 - return false if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit > 30 + return false if !@redeemables_limit.nil? && @redeemables_limit > 30 + return false if !@redeemables_limit.nil? && @redeemables_limit < 1 + return false if !@applicable_redeemables_limit.nil? && @applicable_redeemables_limit > 30 + return false if !@applicable_redeemables_limit.nil? && @applicable_redeemables_limit < 1 + return false if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit > 5 return false if !@applicable_redeemables_per_category_limit.nil? && @applicable_redeemables_per_category_limit < 1 - return false if @exclusive_categories.nil? - return false if @joint_categories.nil? + return false if !@applicable_exclusive_redeemables_limit.nil? && @applicable_exclusive_redeemables_limit > 5 + return false if !@applicable_exclusive_redeemables_limit.nil? && @applicable_exclusive_redeemables_limit < 1 + return false if !@applicable_exclusive_redeemables_per_category_limit.nil? && @applicable_exclusive_redeemables_per_category_limit > 5 + return false if !@applicable_exclusive_redeemables_per_category_limit.nil? && @applicable_exclusive_redeemables_per_category_limit < 1 redeemables_application_mode_validator = EnumAttributeValidator.new('String', ["ALL", "PARTIAL"]) return false unless redeemables_application_mode_validator.valid?(@redeemables_application_mode) redeemables_sorting_rule_validator = EnumAttributeValidator.new('String', ["CATEGORY_HIERARCHY", "REQUESTED_ORDER"]) return false unless redeemables_sorting_rule_validator.valid?(@redeemables_sorting_rule) + redeemables_products_application_mode_validator = EnumAttributeValidator.new('String', ["STACK", "ONCE"]) + return false unless redeemables_products_application_mode_validator.valid?(@redeemables_products_application_mode) + redeemables_no_effect_rule_validator = EnumAttributeValidator.new('String', ["REDEEM_ANYWAY", "SKIP"]) + return false unless redeemables_no_effect_rule_validator.valid?(@redeemables_no_effect_rule) true end - # Custom attribute writer method with validation - # @param [Object] redeemables_limit Value to be assigned - def redeemables_limit=(redeemables_limit) - if redeemables_limit.nil? - fail ArgumentError, 'redeemables_limit cannot be nil' - end - - if redeemables_limit > 30 - fail ArgumentError, 'invalid value for "redeemables_limit", must be smaller than or equal to 30.' - end - - if redeemables_limit < 1 - fail ArgumentError, 'invalid value for "redeemables_limit", must be greater than or equal to 1.' - end - - @redeemables_limit = redeemables_limit - end - - # Custom attribute writer method with validation - # @param [Object] applicable_redeemables_limit Value to be assigned - def applicable_redeemables_limit=(applicable_redeemables_limit) - if applicable_redeemables_limit.nil? - fail ArgumentError, 'applicable_redeemables_limit cannot be nil' - end - - if applicable_redeemables_limit > 30 - fail ArgumentError, 'invalid value for "applicable_redeemables_limit", must be smaller than or equal to 30.' - end - - if applicable_redeemables_limit < 1 - fail ArgumentError, 'invalid value for "applicable_redeemables_limit", must be greater than or equal to 1.' - end - - @applicable_redeemables_limit = applicable_redeemables_limit - end - - # Custom attribute writer method with validation - # @param [Object] applicable_exclusive_redeemables_limit Value to be assigned - def applicable_exclusive_redeemables_limit=(applicable_exclusive_redeemables_limit) - if applicable_exclusive_redeemables_limit.nil? - fail ArgumentError, 'applicable_exclusive_redeemables_limit cannot be nil' - end - - if applicable_exclusive_redeemables_limit > 30 - fail ArgumentError, 'invalid value for "applicable_exclusive_redeemables_limit", must be smaller than or equal to 30.' - end - - if applicable_exclusive_redeemables_limit < 1 - fail ArgumentError, 'invalid value for "applicable_exclusive_redeemables_limit", must be greater than or equal to 1.' - end - - @applicable_exclusive_redeemables_limit = applicable_exclusive_redeemables_limit - end - - # Custom attribute writer method with validation - # @param [Object] applicable_redeemables_per_category_limit Value to be assigned - def applicable_redeemables_per_category_limit=(applicable_redeemables_per_category_limit) - if applicable_redeemables_per_category_limit.nil? - fail ArgumentError, 'applicable_redeemables_per_category_limit cannot be nil' - end - - if applicable_redeemables_per_category_limit > 30 - fail ArgumentError, 'invalid value for "applicable_redeemables_per_category_limit", must be smaller than or equal to 30.' - end - - if applicable_redeemables_per_category_limit < 1 - fail ArgumentError, 'invalid value for "applicable_redeemables_per_category_limit", must be greater than or equal to 1.' - end - - @applicable_redeemables_per_category_limit = applicable_redeemables_per_category_limit - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] redeemables_application_mode Object to be assigned - def redeemables_application_mode=(redeemables_application_mode) - validator = EnumAttributeValidator.new('String', ["ALL", "PARTIAL"]) - unless validator.valid?(redeemables_application_mode) - fail ArgumentError, "invalid value for \"redeemables_application_mode\", must be one of #{validator.allowable_values}." - end - @redeemables_application_mode = redeemables_application_mode - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] redeemables_sorting_rule Object to be assigned - def redeemables_sorting_rule=(redeemables_sorting_rule) - validator = EnumAttributeValidator.new('String', ["CATEGORY_HIERARCHY", "REQUESTED_ORDER"]) - unless validator.valid?(redeemables_sorting_rule) - fail ArgumentError, "invalid value for \"redeemables_sorting_rule\", must be one of #{validator.allowable_values}." - end - @redeemables_sorting_rule = redeemables_sorting_rule - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -350,12 +276,15 @@ def ==(o) self.class == o.class && redeemables_limit == o.redeemables_limit && applicable_redeemables_limit == o.applicable_redeemables_limit && - applicable_exclusive_redeemables_limit == o.applicable_exclusive_redeemables_limit && applicable_redeemables_per_category_limit == o.applicable_redeemables_per_category_limit && + applicable_exclusive_redeemables_limit == o.applicable_exclusive_redeemables_limit && + applicable_exclusive_redeemables_per_category_limit == o.applicable_exclusive_redeemables_per_category_limit && exclusive_categories == o.exclusive_categories && joint_categories == o.joint_categories && redeemables_application_mode == o.redeemables_application_mode && - redeemables_sorting_rule == o.redeemables_sorting_rule + redeemables_sorting_rule == o.redeemables_sorting_rule && + redeemables_products_application_mode == o.redeemables_products_application_mode && + redeemables_no_effect_rule == o.redeemables_no_effect_rule end # @see the `==` method @@ -367,7 +296,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [redeemables_limit, applicable_redeemables_limit, applicable_exclusive_redeemables_limit, applicable_redeemables_per_category_limit, exclusive_categories, joint_categories, redeemables_application_mode, redeemables_sorting_rule].hash + [redeemables_limit, applicable_redeemables_limit, applicable_redeemables_per_category_limit, applicable_exclusive_redeemables_limit, applicable_exclusive_redeemables_per_category_limit, exclusive_categories, joint_categories, redeemables_application_mode, redeemables_sorting_rule, redeemables_products_application_mode, redeemables_no_effect_rule].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/validation_entity.rb b/lib/VoucherifySdk/models/validation_entity.rb deleted file mode 100644 index 02595161..00000000 --- a/lib/VoucherifySdk/models/validation_entity.rb +++ /dev/null @@ -1,325 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ValidationEntity - # Unique validation id. - attr_accessor :id - - # Unique session id. - attr_accessor :session_id - - # The validation status - attr_accessor :status - - # Timestamp representing the date and time when the validation was created in ISO 8601 format. - attr_accessor :created_at - - # Unique customer ID of the customer making the purchase. - attr_accessor :customer_id - - # Lists validation results of each redeemable. - attr_accessor :redeemables - - # Lists validation results of each redeemable. - attr_accessor :skipped_redeemables - - # Lists validation results of each redeemable. - attr_accessor :inapplicable_redeemables - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'session_id' => :'session_id', - :'status' => :'status', - :'created_at' => :'created_at', - :'customer_id' => :'customer_id', - :'redeemables' => :'redeemables', - :'skipped_redeemables' => :'skipped_redeemables', - :'inapplicable_redeemables' => :'inapplicable_redeemables' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'session_id' => :'String', - :'status' => :'String', - :'created_at' => :'Time', - :'customer_id' => :'String', - :'redeemables' => :'Array', - :'skipped_redeemables' => :'Array', - :'inapplicable_redeemables' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationEntity` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationEntity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'session_id') - self.session_id = attributes[:'session_id'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - - if attributes.key?(:'customer_id') - self.customer_id = attributes[:'customer_id'] - end - - if attributes.key?(:'redeemables') - if (value = attributes[:'redeemables']).is_a?(Array) - self.redeemables = value - end - end - - if attributes.key?(:'skipped_redeemables') - if (value = attributes[:'skipped_redeemables']).is_a?(Array) - self.skipped_redeemables = value - end - end - - if attributes.key?(:'inapplicable_redeemables') - if (value = attributes[:'inapplicable_redeemables']).is_a?(Array) - self.inapplicable_redeemables = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["VALID", "INVALID"]) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["VALID", "INVALID"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - session_id == o.session_id && - status == o.status && - created_at == o.created_at && - customer_id == o.customer_id && - redeemables == o.redeemables && - skipped_redeemables == o.skipped_redeemables && - inapplicable_redeemables == o.inapplicable_redeemables - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, session_id, status, created_at, customer_id, redeemables, skipped_redeemables, inapplicable_redeemables].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/validation_rule.rb b/lib/VoucherifySdk/models/validation_rule.rb index 72750171..f80c7b2c 100644 --- a/lib/VoucherifySdk/models/validation_rule.rb +++ b/lib/VoucherifySdk/models/validation_rule.rb @@ -34,16 +34,16 @@ class ValidationRule # Unique validation rule ID. attr_accessor :id - # Timestamp representing the date and time when the validation rule was created in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # The number of instances the validation rule has been assigned to different types of redeemables. attr_accessor :assignments_count - # The type of object represented by JSON. This object stores information about the validation rule. + # The type of the object represented by JSON. This object stores information about the validation rule. attr_accessor :object class EnumAttributeValidator @@ -95,8 +95,8 @@ def self.openapi_types { :'name' => :'String', :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', + :'error' => :'ValidationRuleError', + :'applicable_to' => :'ValidationRuleApplicableTo', :'type' => :'String', :'context_type' => :'String', :'id' => :'String', @@ -110,41 +110,33 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'error', + :'applicable_to', + :'type', + :'context_type', + :'id', + :'created_at', + :'updated_at', + :'assignments_count', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRuleBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRule` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'rules') self.rules = attributes[:'rules'] - else - self.rules = nil end if attributes.key?(:'error') @@ -153,8 +145,6 @@ def initialize(attributes = {}) if attributes.key?(:'applicable_to') self.applicable_to = attributes[:'applicable_to'] - else - self.applicable_to = nil end if attributes.key?(:'type') @@ -171,14 +161,10 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -201,38 +187,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @rules.nil? - invalid_properties.push('invalid value for "rules", rules cannot be nil.') - end - - if @applicable_to.nil? - invalid_properties.push('invalid value for "applicable_to", applicable_to cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @context_type.nil? - invalid_properties.push('invalid value for "context_type", context_type cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -240,41 +194,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @rules.nil? - return false if @applicable_to.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) return false unless type_validator.valid?(@type) - return false if @context_type.nil? context_type_validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) return false unless context_type_validator.valid?(@context_type) - return false if @id.nil? - return false if @created_at.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rule_applicable_to.rb b/lib/VoucherifySdk/models/validation_rule_applicable_to.rb new file mode 100644 index 00000000..bdf59e26 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rule_applicable_to.rb @@ -0,0 +1,235 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationRuleApplicableTo + # Defines which items are excluded from a discount. + attr_accessor :excluded + + # Defines which items are included in a discount. + attr_accessor :included + + # Indicates whether all items are included in the discount. + attr_accessor :included_all + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'excluded' => :'excluded', + :'included' => :'included', + :'included_all' => :'included_all' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'excluded' => :'Array', + :'included' => :'Array', + :'included_all' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'excluded', + :'included', + :'included_all' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'excluded') + if (value = attributes[:'excluded']).is_a?(Array) + self.excluded = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'included_all') + self.included_all = attributes[:'included_all'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + excluded == o.excluded && + included == o.included && + included_all == o.included_all + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [excluded, included, included_all].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rule_assignment.rb b/lib/VoucherifySdk/models/validation_rule_assignment.rb index 8ba36b05..051ded2c 100644 --- a/lib/VoucherifySdk/models/validation_rule_assignment.rb +++ b/lib/VoucherifySdk/models/validation_rule_assignment.rb @@ -28,10 +28,10 @@ class ValidationRuleAssignment # The type of resource to which the validation rule was assigned. attr_accessor :related_object_type - # Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # The type of object represented by the ID. + # The type of the object represented by the ID. attr_accessor :object class EnumAttributeValidator @@ -88,52 +88,41 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'rule_id', + :'related_object_id', + :'related_object_type', + :'created_at', + :'object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRuleAssignment` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRuleAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'rule_id') self.rule_id = attributes[:'rule_id'] - else - self.rule_id = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'object') @@ -148,30 +137,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @rule_id.nil? - invalid_properties.push('invalid value for "rule_id", rule_id cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -179,39 +144,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @rule_id.nil? - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "campaign", "earning_rule", "reward_assignment", "promotion_tier", "distribution"]) return false unless related_object_type_validator.valid?(@related_object_type) - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["validation_rules_assignment"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "campaign", "earning_rule", "reward_assignment", "promotion_tier", "distribution"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["validation_rules_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rule_assignments_list.rb b/lib/VoucherifySdk/models/validation_rule_assignments_list.rb index 583d8abb..63d90135 100644 --- a/lib/VoucherifySdk/models/validation_rule_assignments_list.rb +++ b/lib/VoucherifySdk/models/validation_rule_assignments_list.rb @@ -16,7 +16,7 @@ module VoucherifySdk # Validation Rule Assignments List class ValidationRuleAssignmentsList - # The type of object represented by JSON. This object stores information about validation rule assignments. + # The type of the object represented by JSON. This object stores information about validation rule assignments. attr_accessor :object # Identifies the name of the JSON property that contains the array of validation rule assignments. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRuleAssignmentsList` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRuleAssignmentsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/validation_rule_base.rb b/lib/VoucherifySdk/models/validation_rule_base.rb deleted file mode 100644 index a2470817..00000000 --- a/lib/VoucherifySdk/models/validation_rule_base.rb +++ /dev/null @@ -1,314 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is an object representing a request validation rule. - class ValidationRuleBase - # Custom, unique name for set of validation rules. - attr_accessor :name - - # Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. - attr_accessor :rules - - attr_accessor :error - - attr_accessor :applicable_to - - # Type of validation rule. - attr_accessor :type - - # Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | - attr_accessor :context_type - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'name' => :'name', - :'rules' => :'rules', - :'error' => :'error', - :'applicable_to' => :'applicable_to', - :'type' => :'type', - :'context_type' => :'context_type' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'name' => :'String', - :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', - :'type' => :'String', - :'context_type' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRuleBase` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRuleBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'rules') - self.rules = attributes[:'rules'] - end - - if attributes.key?(:'error') - self.error = attributes[:'error'] - end - - if attributes.key?(:'applicable_to') - self.applicable_to = attributes[:'applicable_to'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - else - self.type = 'expression' - end - - if attributes.key?(:'context_type') - self.context_type = attributes[:'context_type'] - else - self.context_type = 'global' - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - type_validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - return false unless type_validator.valid?(@type) - context_type_validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - return false unless context_type_validator.valid?(@context_type) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - name == o.name && - rules == o.rules && - error == o.error && - applicable_to == o.applicable_to && - type == o.type && - context_type == o.context_type - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [name, rules, error, applicable_to, type, context_type].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/validation_rule_base_applicable_to.rb b/lib/VoucherifySdk/models/validation_rule_base_applicable_to.rb deleted file mode 100644 index 49dffae7..00000000 --- a/lib/VoucherifySdk/models/validation_rule_base_applicable_to.rb +++ /dev/null @@ -1,239 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ValidationRuleBaseApplicableTo - # Defines which items are excluded from a discount. - attr_accessor :excluded - - # Defines which items are included in a discount. - attr_accessor :included - - # Indicates whether all items are included in the discount. - attr_accessor :included_all - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'excluded' => :'excluded', - :'included' => :'included', - :'included_all' => :'included_all' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'excluded' => :'Array', - :'included' => :'Array', - :'included_all' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRuleBaseApplicableTo` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRuleBaseApplicableTo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'excluded') - if (value = attributes[:'excluded']).is_a?(Array) - self.excluded = value - end - end - - if attributes.key?(:'included') - if (value = attributes[:'included']).is_a?(Array) - self.included = value - end - end - - if attributes.key?(:'included_all') - self.included_all = attributes[:'included_all'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - excluded == o.excluded && - included == o.included && - included_all == o.included_all - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [excluded, included, included_all].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/validation_rule_base_error.rb b/lib/VoucherifySdk/models/validation_rule_base_error.rb deleted file mode 100644 index d2a479ec..00000000 --- a/lib/VoucherifySdk/models/validation_rule_base_error.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. - class ValidationRuleBaseError - # The error message returned from API when validation / redemption fails to meet requirements of defined rules. - attr_accessor :message - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'message' => :'message' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'message' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRuleBaseError` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRuleBaseError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'message') - self.message = attributes[:'message'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - message == o.message - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [message].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/validation_rule_error.rb b/lib/VoucherifySdk/models/validation_rule_error.rb new file mode 100644 index 00000000..3f4d1a0d --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rule_error.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + class ValidationRuleError + # The error message returned from API when validation / redemption fails to meet requirements of defined rules. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_assignments_create_request_body.rb b/lib/VoucherifySdk/models/validation_rules_assignments_create_request_body.rb index 3d11d8ab..7b2f6458 100644 --- a/lib/VoucherifySdk/models/validation_rules_assignments_create_request_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_assignments_create_request_body.rb @@ -14,12 +14,12 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/validation-rules/{validationRuleId}/assignments`. + # Request body schema for **POST** `v1/validation-rules/{validationRuleId}/assignments`. class ValidationRulesAssignmentsCreateRequestBody - # Defines the related object. i.e. `voucher`. + # Defines the related object, e.g. `voucher`. attr_accessor :related_object_type - # Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. + # Unique related object ID assigned by Voucherify, e.g. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. attr_accessor :related_object_id class EnumAttributeValidator @@ -68,21 +68,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'related_object_type', + :'related_object_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesAssignmentsCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesAssignmentsCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -114,16 +109,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "campaign", "earning_rule", "distribution", "reward_assignment"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_assignments_create_response_body.rb b/lib/VoucherifySdk/models/validation_rules_assignments_create_response_body.rb index 91868598..371784a7 100644 --- a/lib/VoucherifySdk/models/validation_rules_assignments_create_response_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_assignments_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body for **POST** `/validation-rules/{validationRuleId}/assignments`. + # Response body for **POST** `v1/validation-rules/{validationRuleId}/assignments`. class ValidationRulesAssignmentsCreateResponseBody # Validation rule assignment ID. attr_accessor :id @@ -28,10 +28,10 @@ class ValidationRulesAssignmentsCreateResponseBody # The type of resource to which the validation rule was assigned. attr_accessor :related_object_type - # Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format. + # Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # The type of object represented by the ID. + # The type of the object represented by the ID. attr_accessor :object class EnumAttributeValidator @@ -88,59 +88,41 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'rule_id', + :'related_object_id', + :'related_object_type', + :'created_at', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRuleAssignment' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesAssignmentsCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesAssignmentsCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'rule_id') self.rule_id = attributes[:'rule_id'] - else - self.rule_id = nil end if attributes.key?(:'related_object_id') self.related_object_id = attributes[:'related_object_id'] - else - self.related_object_id = nil end if attributes.key?(:'related_object_type') self.related_object_type = attributes[:'related_object_type'] - else - self.related_object_type = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'object') @@ -155,30 +137,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @rule_id.nil? - invalid_properties.push('invalid value for "rule_id", rule_id cannot be nil.') - end - - if @related_object_id.nil? - invalid_properties.push('invalid value for "related_object_id", related_object_id cannot be nil.') - end - - if @related_object_type.nil? - invalid_properties.push('invalid value for "related_object_type", related_object_type cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -186,39 +144,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @rule_id.nil? - return false if @related_object_id.nil? - return false if @related_object_type.nil? related_object_type_validator = EnumAttributeValidator.new('String', ["voucher", "campaign", "earning_rule", "reward_assignment", "promotion_tier", "distribution"]) return false unless related_object_type_validator.valid?(@related_object_type) - return false if @created_at.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["validation_rules_assignment"]) return false unless object_validator.valid?(@object) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] related_object_type Object to be assigned - def related_object_type=(related_object_type) - validator = EnumAttributeValidator.new('String', ["voucher", "campaign", "earning_rule", "reward_assignment", "promotion_tier", "distribution"]) - unless validator.valid?(related_object_type) - fail ArgumentError, "invalid value for \"related_object_type\", must be one of #{validator.allowable_values}." - end - @related_object_type = related_object_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["validation_rules_assignment"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_assignments_list.rb b/lib/VoucherifySdk/models/validation_rules_assignments_list.rb index 68017e39..57f81eb5 100644 --- a/lib/VoucherifySdk/models/validation_rules_assignments_list.rb +++ b/lib/VoucherifySdk/models/validation_rules_assignments_list.rb @@ -16,7 +16,7 @@ module VoucherifySdk # List of Validation Rules Assignments class ValidationRulesAssignmentsList - # The type of object represented by JSON. This object stores information about validation rules assignments. + # The type of the object represented by JSON. This object stores information about validation rules assignments. attr_accessor :object # Identifies the name of the attribute that contains the array of validation rules assignments. @@ -78,21 +78,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesAssignmentsList` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesAssignmentsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -112,14 +109,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -128,23 +121,7 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @total < 0 + if !@total.nil? && @total < 0 invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') end @@ -155,52 +132,14 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["list"]) return false unless object_validator.valid?(@object) - return false if @data_ref.nil? data_ref_validator = EnumAttributeValidator.new('String', ["data"]) return false unless data_ref_validator.valid?(@data_ref) - return false if @data.nil? - return false if @total.nil? - return false if @total < 0 + return false if !@total.nil? && @total < 0 true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["list"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] data_ref Object to be assigned - def data_ref=(data_ref) - validator = EnumAttributeValidator.new('String', ["data"]) - unless validator.valid?(data_ref) - fail ArgumentError, "invalid value for \"data_ref\", must be one of #{validator.allowable_values}." - end - @data_ref = data_ref - end - - # Custom attribute writer method with validation - # @param [Object] total Value to be assigned - def total=(total) - if total.nil? - fail ArgumentError, 'total cannot be nil' - end - - if total < 0 - fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' - end - - @total = total - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_assignments_list_response_body.rb b/lib/VoucherifySdk/models/validation_rules_assignments_list_response_body.rb index e8f19c64..96979690 100644 --- a/lib/VoucherifySdk/models/validation_rules_assignments_list_response_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_assignments_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body for **GET** `/validation-rules-assignments` and **GET** `/validation-rules/{validationRuleId}/assignments`. + # Response body for **GET** `v1/validation-rules-assignments` and **GET** `v1/validation-rules/{validationRuleId}/assignments`. class ValidationRulesAssignmentsListResponseBody - # The type of object represented by JSON. This object stores information about validation rule assignments. + # The type of the object represented by JSON. This object stores information about validation rule assignments. attr_accessor :object # Identifies the name of the JSON property that contains the array of validation rule assignments. @@ -56,28 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRuleAssignmentsList' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesAssignmentsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesAssignmentsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -97,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -113,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -136,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/validation_rules_create_request_body.rb b/lib/VoucherifySdk/models/validation_rules_create_request_body.rb index 54b6a3b8..08645a38 100644 --- a/lib/VoucherifySdk/models/validation_rules_create_request_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/validation-rules`. + # Request body schema for **POST** `v1/validation-rules`. class ValidationRulesCreateRequestBody # Custom, unique name for set of validation rules. attr_accessor :name @@ -76,8 +76,8 @@ def self.openapi_types { :'name' => :'String', :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', + :'error' => :'ValidationRulesCreateRequestBodyError', + :'applicable_to' => :'ValidationRulesCreateRequestBodyApplicableTo', :'type' => :'String', :'context_type' => :'String' } @@ -86,35 +86,24 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'error', + :'applicable_to', + :'type', + :'context_type' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRuleBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'rules') @@ -147,10 +136,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -158,7 +143,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? type_validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) return false unless type_validator.valid?(@type) context_type_validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) @@ -166,26 +150,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_create_request_body_applicable_to.rb b/lib/VoucherifySdk/models/validation_rules_create_request_body_applicable_to.rb new file mode 100644 index 00000000..7622c694 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_create_request_body_applicable_to.rb @@ -0,0 +1,235 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationRulesCreateRequestBodyApplicableTo + # Defines which items are excluded from a discount. + attr_accessor :excluded + + # Defines which items are included in a discount. + attr_accessor :included + + # Indicates whether all items are included in the discount. + attr_accessor :included_all + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'excluded' => :'excluded', + :'included' => :'included', + :'included_all' => :'included_all' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'excluded' => :'Array', + :'included' => :'Array', + :'included_all' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'excluded', + :'included', + :'included_all' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'excluded') + if (value = attributes[:'excluded']).is_a?(Array) + self.excluded = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'included_all') + self.included_all = attributes[:'included_all'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + excluded == o.excluded && + included == o.included && + included_all == o.included_all + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [excluded, included, included_all].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_create_request_body_error.rb b/lib/VoucherifySdk/models/validation_rules_create_request_body_error.rb new file mode 100644 index 00000000..113aa160 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_create_request_body_error.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + class ValidationRulesCreateRequestBodyError + # The error message returned from API when validation / redemption fails to meet requirements of defined rules. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_create_response_body.rb b/lib/VoucherifySdk/models/validation_rules_create_response_body.rb index 23cae9fb..3151aabb 100644 --- a/lib/VoucherifySdk/models/validation_rules_create_response_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/validation-rules`. + # Response body schema for **POST** `v1/validation-rules`. class ValidationRulesCreateResponseBody # Custom, unique name for set of validation rules. attr_accessor :name @@ -35,16 +35,16 @@ class ValidationRulesCreateResponseBody # Unique validation rule ID. attr_accessor :id - # Timestamp representing the date and time when the validation rule was created in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # The number of instances the validation rule has been assigned to different types of redeemables. attr_accessor :assignments_count - # The type of object represented by JSON. This object stores information about the validation rule. + # The type of the object represented by JSON. This object stores information about the validation rule. attr_accessor :object class EnumAttributeValidator @@ -96,8 +96,8 @@ def self.openapi_types { :'name' => :'String', :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', + :'error' => :'ValidationRulesCreateResponseBodyError', + :'applicable_to' => :'ValidationRulesCreateResponseBodyApplicableTo', :'type' => :'String', :'context_type' => :'String', :'id' => :'String', @@ -111,41 +111,33 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'error', + :'applicable_to', + :'type', + :'context_type', + :'id', + :'created_at', + :'updated_at', + :'assignments_count', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRule' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'rules') self.rules = attributes[:'rules'] - else - self.rules = nil end if attributes.key?(:'error') @@ -154,8 +146,6 @@ def initialize(attributes = {}) if attributes.key?(:'applicable_to') self.applicable_to = attributes[:'applicable_to'] - else - self.applicable_to = nil end if attributes.key?(:'type') @@ -172,14 +162,10 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -202,38 +188,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @rules.nil? - invalid_properties.push('invalid value for "rules", rules cannot be nil.') - end - - if @applicable_to.nil? - invalid_properties.push('invalid value for "applicable_to", applicable_to cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @context_type.nil? - invalid_properties.push('invalid value for "context_type", context_type cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -241,41 +195,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @rules.nil? - return false if @applicable_to.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) return false unless type_validator.valid?(@type) - return false if @context_type.nil? context_type_validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) return false unless context_type_validator.valid?(@context_type) - return false if @id.nil? - return false if @created_at.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_create_response_body_applicable_to.rb b/lib/VoucherifySdk/models/validation_rules_create_response_body_applicable_to.rb new file mode 100644 index 00000000..7bc6a361 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_create_response_body_applicable_to.rb @@ -0,0 +1,235 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationRulesCreateResponseBodyApplicableTo + # Defines which items are excluded from a discount. + attr_accessor :excluded + + # Defines which items are included in a discount. + attr_accessor :included + + # Indicates whether all items are included in the discount. + attr_accessor :included_all + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'excluded' => :'excluded', + :'included' => :'included', + :'included_all' => :'included_all' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'excluded' => :'Array', + :'included' => :'Array', + :'included_all' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'excluded', + :'included', + :'included_all' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'excluded') + if (value = attributes[:'excluded']).is_a?(Array) + self.excluded = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'included_all') + self.included_all = attributes[:'included_all'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + excluded == o.excluded && + included == o.included && + included_all == o.included_all + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [excluded, included, included_all].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_create_response_body_error.rb b/lib/VoucherifySdk/models/validation_rules_create_response_body_error.rb new file mode 100644 index 00000000..287e74eb --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_create_response_body_error.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + class ValidationRulesCreateResponseBodyError + # The error message returned from API when validation / redemption fails to meet requirements of defined rules. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_get_response_body.rb b/lib/VoucherifySdk/models/validation_rules_get_response_body.rb index d3bd7bb5..7f1ccb83 100644 --- a/lib/VoucherifySdk/models/validation_rules_get_response_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/validation-rules/{validationRuleId}`. + # Response body schema for **GET** `v1/validation-rules/{validationRuleId}`. class ValidationRulesGetResponseBody # Custom, unique name for set of validation rules. attr_accessor :name @@ -35,16 +35,16 @@ class ValidationRulesGetResponseBody # Unique validation rule ID. attr_accessor :id - # Timestamp representing the date and time when the validation rule was created in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # The number of instances the validation rule has been assigned to different types of redeemables. attr_accessor :assignments_count - # The type of object represented by JSON. This object stores information about the validation rule. + # The type of the object represented by JSON. This object stores information about the validation rule. attr_accessor :object class EnumAttributeValidator @@ -96,8 +96,8 @@ def self.openapi_types { :'name' => :'String', :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', + :'error' => :'ValidationRulesGetResponseBodyError', + :'applicable_to' => :'ValidationRulesGetResponseBodyApplicableTo', :'type' => :'String', :'context_type' => :'String', :'id' => :'String', @@ -111,41 +111,33 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'error', + :'applicable_to', + :'type', + :'context_type', + :'id', + :'created_at', + :'updated_at', + :'assignments_count', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRule' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'rules') self.rules = attributes[:'rules'] - else - self.rules = nil end if attributes.key?(:'error') @@ -154,8 +146,6 @@ def initialize(attributes = {}) if attributes.key?(:'applicable_to') self.applicable_to = attributes[:'applicable_to'] - else - self.applicable_to = nil end if attributes.key?(:'type') @@ -172,14 +162,10 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -202,38 +188,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @rules.nil? - invalid_properties.push('invalid value for "rules", rules cannot be nil.') - end - - if @applicable_to.nil? - invalid_properties.push('invalid value for "applicable_to", applicable_to cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @context_type.nil? - invalid_properties.push('invalid value for "context_type", context_type cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -241,41 +195,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @rules.nil? - return false if @applicable_to.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) return false unless type_validator.valid?(@type) - return false if @context_type.nil? context_type_validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) return false unless context_type_validator.valid?(@context_type) - return false if @id.nil? - return false if @created_at.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_get_response_body_applicable_to.rb b/lib/VoucherifySdk/models/validation_rules_get_response_body_applicable_to.rb new file mode 100644 index 00000000..239dd883 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_get_response_body_applicable_to.rb @@ -0,0 +1,235 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationRulesGetResponseBodyApplicableTo + # Defines which items are excluded from a discount. + attr_accessor :excluded + + # Defines which items are included in a discount. + attr_accessor :included + + # Indicates whether all items are included in the discount. + attr_accessor :included_all + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'excluded' => :'excluded', + :'included' => :'included', + :'included_all' => :'included_all' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'excluded' => :'Array', + :'included' => :'Array', + :'included_all' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'excluded', + :'included', + :'included_all' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'excluded') + if (value = attributes[:'excluded']).is_a?(Array) + self.excluded = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'included_all') + self.included_all = attributes[:'included_all'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + excluded == o.excluded && + included == o.included && + included_all == o.included_all + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [excluded, included, included_all].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_get_response_body_error.rb b/lib/VoucherifySdk/models/validation_rules_get_response_body_error.rb new file mode 100644 index 00000000..46137a71 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_get_response_body_error.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + class ValidationRulesGetResponseBodyError + # The error message returned from API when validation / redemption fails to meet requirements of defined rules. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_list_response_body.rb b/lib/VoucherifySdk/models/validation_rules_list_response_body.rb index b3eaec21..2358e0b3 100644 --- a/lib/VoucherifySdk/models/validation_rules_list_response_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/validation-rules`. + # Response body schema for **GET** `v1/validation-rules`. class ValidationRulesListResponseBody - # The type of object represented by JSON. This object stores information about validation rules. + # The type of the object represented by JSON. This object stores information about validation rules. attr_accessor :object # Identifies the name of the attribute that contains the array of validation rules. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'total' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @total.nil? true end diff --git a/lib/VoucherifySdk/models/validation_rules_update_request_body.rb b/lib/VoucherifySdk/models/validation_rules_update_request_body.rb index 4fc283e1..791f437a 100644 --- a/lib/VoucherifySdk/models/validation_rules_update_request_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_update_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/validation-rules/{validationRuleId}`. + # Response body schema for **PUT** `v1/validation-rules/{validationRuleId}`. class ValidationRulesUpdateRequestBody # Custom, unique name for set of validation rules. attr_accessor :name @@ -76,8 +76,8 @@ def self.openapi_types { :'name' => :'String', :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', + :'error' => :'ValidationRulesUpdateRequestBodyError', + :'applicable_to' => :'ValidationRulesUpdateRequestBodyApplicableTo', :'type' => :'String', :'context_type' => :'String' } @@ -86,28 +86,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'error', + :'applicable_to', + :'type', + :'context_type' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRuleBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -159,26 +150,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_update_request_body_applicable_to.rb b/lib/VoucherifySdk/models/validation_rules_update_request_body_applicable_to.rb new file mode 100644 index 00000000..5be2f926 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_update_request_body_applicable_to.rb @@ -0,0 +1,235 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationRulesUpdateRequestBodyApplicableTo + # Defines which items are excluded from a discount. + attr_accessor :excluded + + # Defines which items are included in a discount. + attr_accessor :included + + # Indicates whether all items are included in the discount. + attr_accessor :included_all + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'excluded' => :'excluded', + :'included' => :'included', + :'included_all' => :'included_all' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'excluded' => :'Array', + :'included' => :'Array', + :'included_all' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'excluded', + :'included', + :'included_all' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'excluded') + if (value = attributes[:'excluded']).is_a?(Array) + self.excluded = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'included_all') + self.included_all = attributes[:'included_all'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + excluded == o.excluded && + included == o.included && + included_all == o.included_all + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [excluded, included, included_all].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_update_request_body_error.rb b/lib/VoucherifySdk/models/validation_rules_update_request_body_error.rb new file mode 100644 index 00000000..357be263 --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_update_request_body_error.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + class ValidationRulesUpdateRequestBodyError + # The error message returned from API when validation / redemption fails to meet requirements of defined rules. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_update_response_body.rb b/lib/VoucherifySdk/models/validation_rules_update_response_body.rb index 0becd285..857006d9 100644 --- a/lib/VoucherifySdk/models/validation_rules_update_response_body.rb +++ b/lib/VoucherifySdk/models/validation_rules_update_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **PUT** `/validation-rules/{validationRuleId}`. + # Response body schema for **PUT** `v1/validation-rules/{validationRuleId}`. class ValidationRulesUpdateResponseBody # Custom, unique name for set of validation rules. attr_accessor :name @@ -35,16 +35,16 @@ class ValidationRulesUpdateResponseBody # Unique validation rule ID. attr_accessor :id - # Timestamp representing the date and time when the validation rule was created in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. attr_accessor :created_at - # Timestamp representing the date and time when the validation rule was updated in ISO 8601 format. + # Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. attr_accessor :updated_at # The number of instances the validation rule has been assigned to different types of redeemables. attr_accessor :assignments_count - # The type of object represented by JSON. This object stores information about the validation rule. + # The type of the object represented by JSON. This object stores information about the validation rule. attr_accessor :object class EnumAttributeValidator @@ -96,8 +96,8 @@ def self.openapi_types { :'name' => :'String', :'rules' => :'Object', - :'error' => :'ValidationRuleBaseError', - :'applicable_to' => :'ValidationRuleBaseApplicableTo', + :'error' => :'ValidationRulesUpdateResponseBodyError', + :'applicable_to' => :'ValidationRulesUpdateResponseBodyApplicableTo', :'type' => :'String', :'context_type' => :'String', :'id' => :'String', @@ -111,41 +111,33 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'name', + :'error', + :'applicable_to', + :'type', + :'context_type', + :'id', + :'created_at', + :'updated_at', + :'assignments_count', + :'object' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'ValidationRule' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationRulesUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationRulesUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'rules') self.rules = attributes[:'rules'] - else - self.rules = nil end if attributes.key?(:'error') @@ -154,8 +146,6 @@ def initialize(attributes = {}) if attributes.key?(:'applicable_to') self.applicable_to = attributes[:'applicable_to'] - else - self.applicable_to = nil end if attributes.key?(:'type') @@ -172,14 +162,10 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'updated_at') @@ -202,38 +188,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @rules.nil? - invalid_properties.push('invalid value for "rules", rules cannot be nil.') - end - - if @applicable_to.nil? - invalid_properties.push('invalid value for "applicable_to", applicable_to cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @context_type.nil? - invalid_properties.push('invalid value for "context_type", context_type cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - invalid_properties end @@ -241,41 +195,13 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @name.nil? - return false if @rules.nil? - return false if @applicable_to.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) return false unless type_validator.valid?(@type) - return false if @context_type.nil? context_type_validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) return false unless context_type_validator.valid?(@context_type) - return false if @id.nil? - return false if @created_at.nil? - return false if @object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["expression", "basic", "advanced", "complex"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] context_type Object to be assigned - def context_type=(context_type) - validator = EnumAttributeValidator.new('String', ["earning_rule.order.paid", "earning_rule.custom_event", "earning_rule.customer.segment.entered", "earning_rule.customer.tier.joined", "earning_rule.customer.tier.left", "earning_rule.customer.tier.upgraded", "earning_rule.customer.tier.downgraded", "earning_rule.customer.tier.prolonged", "campaign.discount_coupons", "campaign.discount_coupons.discount.apply_to_order", "campaign.discount_coupons.discount.apply_to_items", "campaign.discount_coupons.discount.apply_to_items_proportionally", "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", "campaign.discount_coupons.discount.apply_to_items_by_quantity", "campaign.discount_coupons.discount.fixed.apply_to_items", "campaign.discount_coupons.discount.percent.apply_to_items", "campaign.gift_vouchers", "campaign.gift_vouchers.gift.apply_to_order", "campaign.gift_vouchers.gift.apply_to_items", "campaign.referral_program", "campaign.referral_program.discount.apply_to_order", "campaign.referral_program.discount.apply_to_items", "campaign.referral_program.discount.apply_to_items_proportionally", "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", "campaign.referral_program.discount.apply_to_items_by_quantity", "campaign.referral_program.discount.fixed.apply_to_items", "campaign.referral_program.discount.percent.apply_to_items", "campaign.promotion", "campaign.promotion.discount.apply_to_order", "campaign.promotion.discount.apply_to_items", "campaign.promotion.discount.apply_to_items_proportionally", "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", "campaign.promotion.discount.apply_to_items_by_quantity", "campaign.promotion.discount.fixed.apply_to_items", "campaign.promotion.discount.percent.apply_to_items", "campaign.loyalty_program", "campaign.lucky_draw", "voucher.discount_voucher", "voucher.discount_voucher.discount.apply_to_order", "voucher.discount_voucher.discount.apply_to_items", "voucher.discount_voucher.discount.apply_to_items_proportionally", "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", "voucher.discount_voucher.discount.apply_to_items_by_quantity", "voucher.discount_voucher.discount.fixed.apply_to_items", "voucher.discount_voucher.discount.percent.apply_to_items", "voucher.gift_voucher", "voucher.gift_voucher.gift.apply_to_order", "voucher.gift_voucher.gift.apply_to_items", "voucher.loyalty_card", "voucher.lucky_draw_code", "distribution.custom_event", "distribution.order.paid", "distribution.order.created", "distribution.order.canceled", "distribution.order.updated", "reward_assignment.pay_with_points", "global"]) - unless validator.valid?(context_type) - fail ArgumentError, "invalid value for \"context_type\", must be one of #{validator.allowable_values}." - end - @context_type = context_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/validation_rules_update_response_body_applicable_to.rb b/lib/VoucherifySdk/models/validation_rules_update_response_body_applicable_to.rb new file mode 100644 index 00000000..c71759bb --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_update_response_body_applicable_to.rb @@ -0,0 +1,235 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationRulesUpdateResponseBodyApplicableTo + # Defines which items are excluded from a discount. + attr_accessor :excluded + + # Defines which items are included in a discount. + attr_accessor :included + + # Indicates whether all items are included in the discount. + attr_accessor :included_all + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'excluded' => :'excluded', + :'included' => :'included', + :'included_all' => :'included_all' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'excluded' => :'Array', + :'included' => :'Array', + :'included_all' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'excluded', + :'included', + :'included_all' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'excluded') + if (value = attributes[:'excluded']).is_a?(Array) + self.excluded = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'included_all') + self.included_all = attributes[:'included_all'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + excluded == o.excluded && + included == o.included && + included_all == o.included_all + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [excluded, included, included_all].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validation_rules_update_response_body_error.rb b/lib/VoucherifySdk/models/validation_rules_update_response_body_error.rb new file mode 100644 index 00000000..2d91be8b --- /dev/null +++ b/lib/VoucherifySdk/models/validation_rules_update_response_body_error.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + class ValidationRulesUpdateResponseBodyError + # The error message returned from API when validation / redemption fails to meet requirements of defined rules. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_redeemable_applicable.rb b/lib/VoucherifySdk/models/validations_redeemable_applicable.rb deleted file mode 100644 index 06df1785..00000000 --- a/lib/VoucherifySdk/models/validations_redeemable_applicable.rb +++ /dev/null @@ -1,340 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - class ValidationsRedeemableApplicable - # Indicates whether the redeemable can be applied or not applied based on the validation rules. - attr_accessor :status - - # Redeemable ID, i.e. the voucher code. - attr_accessor :id - - # Redeemable's object type. - attr_accessor :object - - attr_accessor :order - - attr_accessor :applicable_to - - attr_accessor :inapplicable_to - - attr_accessor :result - - # The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. - attr_accessor :metadata - - attr_accessor :categories - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'status' => :'status', - :'id' => :'id', - :'object' => :'object', - :'order' => :'order', - :'applicable_to' => :'applicable_to', - :'inapplicable_to' => :'inapplicable_to', - :'result' => :'result', - :'metadata' => :'metadata', - :'categories' => :'categories' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'status' => :'String', - :'id' => :'String', - :'object' => :'String', - :'order' => :'OrderCalculated', - :'applicable_to' => :'ApplicableToResultList', - :'inapplicable_to' => :'InapplicableToResultList', - :'result' => :'ValidationsRedeemableApplicableResult', - :'metadata' => :'Object', - :'categories' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationsRedeemableApplicable` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationsRedeemableApplicable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'APPLICABLE' - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - end - - if attributes.key?(:'order') - self.order = attributes[:'order'] - end - - if attributes.key?(:'applicable_to') - self.applicable_to = attributes[:'applicable_to'] - end - - if attributes.key?(:'inapplicable_to') - self.inapplicable_to = attributes[:'inapplicable_to'] - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - end - - if attributes.key?(:'metadata') - self.metadata = attributes[:'metadata'] - end - - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["APPLICABLE"]) - return false unless status_validator.valid?(@status) - object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) - return false unless object_validator.valid?(@object) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["APPLICABLE"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - status == o.status && - id == o.id && - object == o.object && - order == o.order && - applicable_to == o.applicable_to && - inapplicable_to == o.inapplicable_to && - result == o.result && - metadata == o.metadata && - categories == o.categories - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [status, id, object, order, applicable_to, inapplicable_to, result, metadata, categories].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/validations_redeemable_applicable_result.rb b/lib/VoucherifySdk/models/validations_redeemable_applicable_result.rb deleted file mode 100644 index bb873cff..00000000 --- a/lib/VoucherifySdk/models/validations_redeemable_applicable_result.rb +++ /dev/null @@ -1,109 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable. - module ValidationsRedeemableApplicableResult - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'RedeemableResultGiftCard', - :'RedeemableResultLoyaltyCard', - :'RedeemableResultPromotionStack', - :'RedeemableResultPromotionTier', - :'RedeemableResultVoucherCode' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/validations_redeemable_inapplicable.rb b/lib/VoucherifySdk/models/validations_redeemable_inapplicable.rb index 30a3c758..1b16b1e1 100644 --- a/lib/VoucherifySdk/models/validations_redeemable_inapplicable.rb +++ b/lib/VoucherifySdk/models/validations_redeemable_inapplicable.rb @@ -26,6 +26,11 @@ class ValidationsRedeemableInapplicable attr_accessor :result + # The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. + attr_accessor :metadata + + attr_accessor :categories + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -54,7 +59,9 @@ def self.attribute_map :'status' => :'status', :'id' => :'id', :'object' => :'object', - :'result' => :'result' + :'result' => :'result', + :'metadata' => :'metadata', + :'categories' => :'categories' } end @@ -69,28 +76,29 @@ def self.openapi_types :'status' => :'String', :'id' => :'String', :'object' => :'String', - :'result' => :'ValidationsRedeemableInapplicableResult' + :'result' => :'ValidationsRedeemableInapplicableResult', + :'metadata' => :'Object', + :'categories' => :'Array' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'status', + :'id', + :'object', + :'result', + :'metadata', + :'categories' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationsRedeemableInapplicable` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationsRedeemableInapplicable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -111,6 +119,16 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -132,26 +150,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["INAPPLICABLE"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -160,7 +158,9 @@ def ==(o) status == o.status && id == o.id && object == o.object && - result == o.result + result == o.result && + metadata == o.metadata && + categories == o.categories end # @see the `==` method @@ -172,7 +172,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [status, id, object, result].hash + [status, id, object, result, metadata, categories].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result.rb b/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result.rb index 58923450..8d6c0639 100644 --- a/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result.rb +++ b/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result.rb @@ -14,13 +14,17 @@ require 'time' module VoucherifySdk + # Includes the error object with details about the reason why the redeemable is inapplicable class ValidationsRedeemableInapplicableResult attr_accessor :error + attr_accessor :details + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'error' => :'error' + :'error' => :'error', + :'details' => :'details' } end @@ -32,34 +36,33 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'error' => :'Error' + :'error' => :'Error', + :'details' => :'ValidationsRedeemableInapplicableResultDetails' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'details' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationsRedeemableInapplicableResult` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationsRedeemableInapplicableResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'error') self.error = attributes[:'error'] end + + if attributes.key?(:'details') + self.details = attributes[:'details'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -82,7 +85,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - error == o.error + error == o.error && + details == o.details end # @see the `==` method @@ -94,7 +98,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [error].hash + [error, details].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result_details.rb b/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result_details.rb new file mode 100644 index 00000000..aeb501c1 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_redeemable_inapplicable_result_details.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Provides details about the reason why the redeemable is inapplicable. + class ValidationsRedeemableInapplicableResultDetails + # Generic message from the `message` string shown in the `error` object or the message configured in a validation rule. + attr_accessor :message + + # Generic message from the `key` string shown in the `error` object. + attr_accessor :key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'key' => :'key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'message', + :'key' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + key == o.key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_redeemable_skipped.rb b/lib/VoucherifySdk/models/validations_redeemable_skipped.rb index 9505fbe1..e7912960 100644 --- a/lib/VoucherifySdk/models/validations_redeemable_skipped.rb +++ b/lib/VoucherifySdk/models/validations_redeemable_skipped.rb @@ -26,6 +26,11 @@ class ValidationsRedeemableSkipped attr_accessor :result + # The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. + attr_accessor :metadata + + attr_accessor :categories + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -54,7 +59,9 @@ def self.attribute_map :'status' => :'status', :'id' => :'id', :'object' => :'object', - :'result' => :'result' + :'result' => :'result', + :'metadata' => :'metadata', + :'categories' => :'categories' } end @@ -69,28 +76,29 @@ def self.openapi_types :'status' => :'String', :'id' => :'String', :'object' => :'String', - :'result' => :'Object' + :'result' => :'ValidationsRedeemableSkippedResult', + :'metadata' => :'Object', + :'categories' => :'Array' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'status', + :'id', + :'object', + :'result', + :'metadata', + :'categories' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationsRedeemableSkipped` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationsRedeemableSkipped`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -111,6 +119,16 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -132,26 +150,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SKIPPED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -160,7 +158,9 @@ def ==(o) status == o.status && id == o.id && object == o.object && - result == o.result + result == o.result && + metadata == o.metadata && + categories == o.categories end # @see the `==` method @@ -172,7 +172,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [status, id, object, result].hash + [status, id, object, result, metadata, categories].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/validations_redeemable_skipped_result.rb b/lib/VoucherifySdk/models/validations_redeemable_skipped_result.rb new file mode 100644 index 00000000..34d7497b --- /dev/null +++ b/lib/VoucherifySdk/models/validations_redeemable_skipped_result.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Provides details about the reason why the redeemable is skipped. + class ValidationsRedeemableSkippedResult + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'details' => :'details' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'details' => :'ValidationsRedeemableSkippedResultDetails' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'details' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'details') + self.details = attributes[:'details'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + details == o.details + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [details].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_redeemable_skipped_result_details.rb b/lib/VoucherifySdk/models/validations_redeemable_skipped_result_details.rb new file mode 100644 index 00000000..eb20f746 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_redeemable_skipped_result_details.rb @@ -0,0 +1,242 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsRedeemableSkippedResultDetails + attr_accessor :key + + attr_accessor :message + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'key' => :'key', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'key' => :'String', + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'key', + :'message' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + key_validator = EnumAttributeValidator.new('String', ["applicable_redeemables_limit_exceeded", "applicable_redeemables_per_category_limit_exceeded", "applicable_exclusive_redeemables_limit_exceeded", "applicable_exclusive_redeemables_per_category_limit_exceeded", "exclusion_rules_not_met", "preceding_validation_failed"]) + return false unless key_validator.valid?(@key) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [key, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_all_response_body_redeemables_item.rb b/lib/VoucherifySdk/models/validations_validate_all_response_body_redeemables_item.rb deleted file mode 100644 index e751f7d4..00000000 --- a/lib/VoucherifySdk/models/validations_validate_all_response_body_redeemables_item.rb +++ /dev/null @@ -1,106 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module ValidationsValidateAllResponseBodyRedeemablesItem - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'ValidationsRedeemableApplicable', - :'ValidationsRedeemableInapplicable', - :'ValidationsRedeemableSkipped' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/validations_validate_request_body.rb b/lib/VoucherifySdk/models/validations_validate_request_body.rb index 5b9970bc..3662cca6 100644 --- a/lib/VoucherifySdk/models/validations_validate_request_body.rb +++ b/lib/VoucherifySdk/models/validations_validate_request_body.rb @@ -14,9 +14,10 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/validations`. + # Response body schema for **POST** `v1/validations`. class ValidationsValidateRequestBody - # An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array. + attr_accessor :options + attr_accessor :redeemables attr_accessor :order @@ -31,18 +32,16 @@ class ValidationsValidateRequestBody # A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. attr_accessor :metadata - attr_accessor :options - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'options' => :'options', :'redeemables' => :'redeemables', :'order' => :'order', :'customer' => :'customer', :'session' => :'session', :'tracking_id' => :'tracking_id', - :'metadata' => :'metadata', - :'options' => :'options' + :'metadata' => :'metadata' } end @@ -54,50 +53,42 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'redeemables' => :'Array', + :'options' => :'ValidationsValidateRequestBodyOptions', + :'redeemables' => :'Array', :'order' => :'Order', :'customer' => :'Customer', :'session' => :'Session', :'tracking_id' => :'String', - :'metadata' => :'Object', - :'options' => :'ClientValidationsValidateRequestBodyAllOfOptions' + :'metadata' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'options', + :'redeemables', + :'tracking_id', + :'metadata' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'StackableValidateRedeemBase' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationsValidateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationsValidateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } + if attributes.key?(:'options') + self.options = attributes[:'options'] + end + if attributes.key?(:'redeemables') if (value = attributes[:'redeemables']).is_a?(Array) self.redeemables = value end - else - self.redeemables = nil end if attributes.key?(:'order') @@ -119,10 +110,6 @@ def initialize(attributes = {}) if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end - - if attributes.key?(:'options') - self.options = attributes[:'options'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -130,18 +117,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') - end - - if @redeemables.length > 5 - invalid_properties.push('invalid value for "redeemables", number of items must be less than or equal to 5.') - end - - if @redeemables.length < 1 - invalid_properties.push('invalid value for "redeemables", number of items must be greater than or equal to 1.') - end - invalid_properties end @@ -149,42 +124,21 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemables.nil? - return false if @redeemables.length > 5 - return false if @redeemables.length < 1 true end - # Custom attribute writer method with validation - # @param [Object] redeemables Value to be assigned - def redeemables=(redeemables) - if redeemables.nil? - fail ArgumentError, 'redeemables cannot be nil' - end - - if redeemables.length > 5 - fail ArgumentError, 'invalid value for "redeemables", number of items must be less than or equal to 5.' - end - - if redeemables.length < 1 - fail ArgumentError, 'invalid value for "redeemables", number of items must be greater than or equal to 1.' - end - - @redeemables = redeemables - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + options == o.options && redeemables == o.redeemables && order == o.order && customer == o.customer && session == o.session && tracking_id == o.tracking_id && - metadata == o.metadata && - options == o.options + metadata == o.metadata end # @see the `==` method @@ -196,7 +150,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [redeemables, order, customer, session, tracking_id, metadata, options].hash + [options, redeemables, order, customer, session, tracking_id, metadata].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/validations_validate_request_body_options.rb b/lib/VoucherifySdk/models/validations_validate_request_body_options.rb new file mode 100644 index 00000000..0256cdb7 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_request_body_options.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Configure parameters returned in the response. + class ValidationsValidateRequestBodyOptions + # The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | + attr_accessor :expand + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expand' => :'expand' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expand' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'expand' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'expand') + if (value = attributes[:'expand']).is_a?(Array) + self.expand = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expand == o.expand + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expand].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item.rb b/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item.rb new file mode 100644 index 00000000..305c7fe5 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item.rb @@ -0,0 +1,260 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateRequestBodyRedeemablesItem + attr_accessor :object + + attr_accessor :id + + attr_accessor :gift + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'id' => :'id', + :'gift' => :'gift', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'id' => :'String', + :'gift' => :'ValidationsValidateRequestBodyRedeemablesItemGift', + :'reward' => :'ValidationsValidateRequestBodyRedeemablesItemReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'gift', + :'reward' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier", "promotion_stack"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + id == o.id && + gift == o.gift && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, id, gift, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item_gift.rb b/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item_gift.rb new file mode 100644 index 00000000..777f8234 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information on the number of gift card credits that the customer wants to apply to the order. + class ValidationsValidateRequestBodyRedeemablesItemGift + # The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + attr_accessor :credits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credits' => :'credits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credits' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'credits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'credits') + self.credits = attributes[:'credits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credits == o.credits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item_reward.rb b/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item_reward.rb new file mode 100644 index 00000000..45d15fd9 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_request_body_redeemables_item_reward.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + class ValidationsValidateRequestBodyRedeemablesItemReward + # Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + attr_accessor :id + + # The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body.rb b/lib/VoucherifySdk/models/validations_validate_response_body.rb index 8f76457c..e8186c24 100644 --- a/lib/VoucherifySdk/models/validations_validate_response_body.rb +++ b/lib/VoucherifySdk/models/validations_validate_response_body.rb @@ -19,7 +19,6 @@ class ValidationsValidateResponseBody # The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. attr_accessor :valid - # Lists validation results of each redeemable. If redeemables_application_mode=\"PARTIAL\" all redeemables here will be \"APPLICABLE\" attr_accessor :redeemables # Lists validation results of each skipped redeemable. @@ -35,6 +34,8 @@ class ValidationsValidateResponseBody attr_accessor :session + attr_accessor :stacking_rules + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -44,7 +45,8 @@ def self.attribute_map :'inapplicable_redeemables' => :'inapplicable_redeemables', :'order' => :'order', :'tracking_id' => :'tracking_id', - :'session' => :'session' + :'session' => :'session', + :'stacking_rules' => :'stacking_rules' } end @@ -57,48 +59,43 @@ def self.acceptable_attributes def self.openapi_types { :'valid' => :'Boolean', - :'redeemables' => :'Array', - :'skipped_redeemables' => :'Array', + :'redeemables' => :'Array', + :'skipped_redeemables' => :'Array', :'inapplicable_redeemables' => :'Array', :'order' => :'OrderCalculated', :'tracking_id' => :'String', - :'session' => :'Session' + :'session' => :'Session', + :'stacking_rules' => :'StackingRules' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'valid', + :'redeemables', + :'skipped_redeemables', + :'inapplicable_redeemables', + :'tracking_id', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::ValidationsValidateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::ValidationsValidateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'valid') self.valid = attributes[:'valid'] - else - self.valid = nil end if attributes.key?(:'redeemables') if (value = attributes[:'redeemables']).is_a?(Array) self.redeemables = value end - else - self.redeemables = nil end if attributes.key?(:'skipped_redeemables') @@ -124,6 +121,12 @@ def initialize(attributes = {}) if attributes.key?(:'session') self.session = attributes[:'session'] end + + if attributes.key?(:'stacking_rules') + self.stacking_rules = attributes[:'stacking_rules'] + else + self.stacking_rules = nil + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -131,12 +134,8 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @valid.nil? - invalid_properties.push('invalid value for "valid", valid cannot be nil.') - end - - if @redeemables.nil? - invalid_properties.push('invalid value for "redeemables", redeemables cannot be nil.') + if @stacking_rules.nil? + invalid_properties.push('invalid value for "stacking_rules", stacking_rules cannot be nil.') end invalid_properties @@ -146,8 +145,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @valid.nil? - return false if @redeemables.nil? + return false if @stacking_rules.nil? true end @@ -162,7 +160,8 @@ def ==(o) inapplicable_redeemables == o.inapplicable_redeemables && order == o.order && tracking_id == o.tracking_id && - session == o.session + session == o.session && + stacking_rules == o.stacking_rules end # @see the `==` method @@ -174,7 +173,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [valid, redeemables, skipped_redeemables, inapplicable_redeemables, order, tracking_id, session].hash + [valid, redeemables, skipped_redeemables, inapplicable_redeemables, order, tracking_id, session, stacking_rules].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item.rb new file mode 100644 index 00000000..c1fe95d6 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item.rb @@ -0,0 +1,312 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateResponseBodyRedeemablesItem + attr_accessor :status + + # Redeemable ID, i.e. the voucher code. + attr_accessor :id + + # Redeemable's object type. + attr_accessor :object + + attr_accessor :order + + attr_accessor :applicable_to + + attr_accessor :inapplicable_to + + attr_accessor :result + + attr_accessor :metadata + + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'id' => :'id', + :'object' => :'object', + :'order' => :'order', + :'applicable_to' => :'applicable_to', + :'inapplicable_to' => :'inapplicable_to', + :'result' => :'result', + :'metadata' => :'metadata', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String', + :'id' => :'String', + :'object' => :'String', + :'order' => :'OrderCalculated', + :'applicable_to' => :'ApplicableToResultList', + :'inapplicable_to' => :'InapplicableToResultList', + :'result' => :'ValidationsValidateResponseBodyRedeemablesItemResult', + :'metadata' => :'Object', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'object', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'applicable_to') + self.applicable_to = attributes[:'applicable_to'] + end + + if attributes.key?(:'inapplicable_to') + self.inapplicable_to = attributes[:'inapplicable_to'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["APPLICABLE", "INAPPLICABLE", "SKIPPED"]) + return false unless status_validator.valid?(@status) + object_validator = EnumAttributeValidator.new('String', ["voucher", "promotion_tier"]) + return false unless object_validator.valid?(@object) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + id == o.id && + object == o.object && + order == o.order && + applicable_to == o.applicable_to && + inapplicable_to == o.inapplicable_to && + result == o.result && + metadata == o.metadata && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status, id, object, order, applicable_to, inapplicable_to, result, metadata, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result.rb new file mode 100644 index 00000000..e7258986 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result.rb @@ -0,0 +1,244 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateResponseBodyRedeemablesItemResult + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + attr_accessor :error + + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'error' => :'error', + :'details' => :'details' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'discount' => :'ValidationsValidateResponseBodyRedeemablesItemResultDiscount', + :'gift' => :'ValidationsValidateResponseBodyRedeemablesItemResultGift', + :'loyalty_card' => :'ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard', + :'error' => :'Error', + :'details' => :'ValidationsValidateResponseBodyRedeemablesItemResultDetails' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'gift', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'details') + self.details = attributes[:'details'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + error == o.error && + details == o.details + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [discount, gift, loyalty_card, error, details].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_details.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_details.rb new file mode 100644 index 00000000..00413265 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_details.rb @@ -0,0 +1,216 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateResponseBodyRedeemablesItemResultDetails + attr_accessor :key + + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'key' => :'key', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'key' => :'String', + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [key, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount.rb new file mode 100644 index 00000000..65d96af8 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount.rb @@ -0,0 +1,400 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateResponseBodyRedeemablesItemResultDiscount + attr_accessor :type + + # Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. + attr_accessor :amount_off + + attr_accessor :amount_off_formula + + # Maximum discount amount per order. + attr_accessor :aggregated_amount_limit + + attr_accessor :effect + + # Flag indicating whether the discount was calculated using a formula. + attr_accessor :is_dynamic + + # Number of units to be granted a full value discount. + attr_accessor :unit_off + + attr_accessor :unit_off_formula + + # The product deemed as free, chosen from product inventory (e.g. time, items). + attr_accessor :unit_type + + attr_accessor :product + + attr_accessor :sku + + attr_accessor :units + + # The percent discount that the customer will receive. + attr_accessor :percent_off + + attr_accessor :percent_off_formula + + # Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + attr_accessor :amount_limit + + # Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. + attr_accessor :fixed_amount + + attr_accessor :fixed_amount_formula + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'amount_off' => :'amount_off', + :'amount_off_formula' => :'amount_off_formula', + :'aggregated_amount_limit' => :'aggregated_amount_limit', + :'effect' => :'effect', + :'is_dynamic' => :'is_dynamic', + :'unit_off' => :'unit_off', + :'unit_off_formula' => :'unit_off_formula', + :'unit_type' => :'unit_type', + :'product' => :'product', + :'sku' => :'sku', + :'units' => :'units', + :'percent_off' => :'percent_off', + :'percent_off_formula' => :'percent_off_formula', + :'amount_limit' => :'amount_limit', + :'fixed_amount' => :'fixed_amount', + :'fixed_amount_formula' => :'fixed_amount_formula' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'amount_off' => :'Float', + :'amount_off_formula' => :'String', + :'aggregated_amount_limit' => :'Integer', + :'effect' => :'String', + :'is_dynamic' => :'Boolean', + :'unit_off' => :'Integer', + :'unit_off_formula' => :'String', + :'unit_type' => :'String', + :'product' => :'ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct', + :'sku' => :'SimpleSkuDiscountUnit', + :'units' => :'Array', + :'percent_off' => :'Float', + :'percent_off_formula' => :'String', + :'amount_limit' => :'Float', + :'fixed_amount' => :'Float', + :'fixed_amount_formula' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount_off', + :'amount_off_formula', + :'aggregated_amount_limit', + :'is_dynamic', + :'unit_off', + :'unit_off_formula', + :'unit_type', + :'units', + :'percent_off', + :'percent_off_formula', + :'amount_limit', + :'fixed_amount', + :'fixed_amount_formula' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'amount_off') + self.amount_off = attributes[:'amount_off'] + end + + if attributes.key?(:'amount_off_formula') + self.amount_off_formula = attributes[:'amount_off_formula'] + end + + if attributes.key?(:'aggregated_amount_limit') + self.aggregated_amount_limit = attributes[:'aggregated_amount_limit'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + + if attributes.key?(:'is_dynamic') + self.is_dynamic = attributes[:'is_dynamic'] + end + + if attributes.key?(:'unit_off') + self.unit_off = attributes[:'unit_off'] + end + + if attributes.key?(:'unit_off_formula') + self.unit_off_formula = attributes[:'unit_off_formula'] + end + + if attributes.key?(:'unit_type') + self.unit_type = attributes[:'unit_type'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'units') + if (value = attributes[:'units']).is_a?(Array) + self.units = value + end + end + + if attributes.key?(:'percent_off') + self.percent_off = attributes[:'percent_off'] + end + + if attributes.key?(:'percent_off_formula') + self.percent_off_formula = attributes[:'percent_off_formula'] + end + + if attributes.key?(:'amount_limit') + self.amount_limit = attributes[:'amount_limit'] + end + + if attributes.key?(:'fixed_amount') + self.fixed_amount = attributes[:'fixed_amount'] + end + + if attributes.key?(:'fixed_amount_formula') + self.fixed_amount_formula = attributes[:'fixed_amount_formula'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["AMOUNT", "UNIT", "PERCENT", "FIXED"]) + return false unless type_validator.valid?(@type) + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS", "APPLY_TO_ITEMS_PROPORTIONALLY", "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", "APPLY_TO_ITEMS_BY_QUANTITY", "ADD_MISSING_ITEMS", "ADD_NEW_ITEMS", "ADD_MANY_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + amount_off == o.amount_off && + amount_off_formula == o.amount_off_formula && + aggregated_amount_limit == o.aggregated_amount_limit && + effect == o.effect && + is_dynamic == o.is_dynamic && + unit_off == o.unit_off && + unit_off_formula == o.unit_off_formula && + unit_type == o.unit_type && + product == o.product && + sku == o.sku && + units == o.units && + percent_off == o.percent_off && + percent_off_formula == o.percent_off_formula && + amount_limit == o.amount_limit && + fixed_amount == o.fixed_amount && + fixed_amount_formula == o.fixed_amount_formula + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, amount_off, amount_off_formula, aggregated_amount_limit, effect, is_dynamic, unit_off, unit_off_formula, unit_type, product, sku, units, percent_off, percent_off_formula, amount_limit, fixed_amount, fixed_amount_formula].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount_product.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount_product.rb new file mode 100644 index 00000000..721128ad --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount_product.rb @@ -0,0 +1,231 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + # Unique product ID, assigned by Voucherify. + attr_accessor :id + + # Product's source ID. + attr_accessor :source_id + + # Product name. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'source_id' => :'source_id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'source_id' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'source_id', + :'name' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'source_id') + self.source_id = attributes[:'source_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + source_id == o.source_id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, source_id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_gift.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_gift.rb new file mode 100644 index 00000000..dbdf5f17 --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_gift.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores the amount of gift card credits to be applied in the redemption. + class ValidationsValidateResponseBodyRedeemablesItemResultGift + # Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). + attr_accessor :credits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credits' => :'credits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credits' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'credits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'credits') + self.credits = attributes[:'credits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credits == o.credits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_loyalty_card.rb b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_loyalty_card.rb new file mode 100644 index 00000000..5c009b4b --- /dev/null +++ b/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_loyalty_card.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + # Total number of loyalty points to be applied in the redemption. + attr_accessor :points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validity_hours.rb b/lib/VoucherifySdk/models/validity_hours.rb new file mode 100644 index 00000000..258594b5 --- /dev/null +++ b/lib/VoucherifySdk/models/validity_hours.rb @@ -0,0 +1,212 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Determines the hours of validity, e.g. to create a happy hours scenario. + class ValidityHours + # Defines the reccuring period(s) when the resource is active. The periods should not overlap. + attr_accessor :daily + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'daily' => :'daily' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'daily' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'daily' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'daily') + if (value = attributes[:'daily']).is_a?(Array) + self.daily = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + daily == o.daily + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [daily].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validity_hours_daily_item.rb b/lib/VoucherifySdk/models/validity_hours_daily_item.rb new file mode 100644 index 00000000..bf6ec9a8 --- /dev/null +++ b/lib/VoucherifySdk/models/validity_hours_daily_item.rb @@ -0,0 +1,253 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Defines the reccuring period(s) when the resource will be active. + class ValidityHoursDailyItem + # Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time. + attr_accessor :start_time + + # Integer array corresponding to the particular days of the week in which the resource is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :days_of_week + + # Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time. + attr_accessor :expiration_time + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'start_time' => :'start_time', + :'days_of_week' => :'days_of_week', + :'expiration_time' => :'expiration_time' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'start_time' => :'String', + :'days_of_week' => :'Array', + :'expiration_time' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'days_of_week') + if (value = attributes[:'days_of_week']).is_a?(Array) + self.days_of_week = value + end + end + + if attributes.key?(:'expiration_time') + self.expiration_time = attributes[:'expiration_time'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + start_time == o.start_time && + days_of_week == o.days_of_week && + expiration_time == o.expiration_time + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [start_time, days_of_week, expiration_time].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/validity_timeframe.rb b/lib/VoucherifySdk/models/validity_timeframe.rb new file mode 100644 index 00000000..1b684128 --- /dev/null +++ b/lib/VoucherifySdk/models/validity_timeframe.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`. + class ValidityTimeframe + # Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour. + attr_accessor :duration + + # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day. + attr_accessor :interval + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'duration' => :'duration', + :'interval' => :'interval' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'duration' => :'String', + :'interval' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'duration', + :'interval' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + duration == o.duration && + interval == o.interval + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [duration, interval].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher.rb b/lib/VoucherifySdk/models/voucher.rb index 1c632cfc..3135600f 100644 --- a/lib/VoucherifySdk/models/voucher.rb +++ b/lib/VoucherifySdk/models/voucher.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # This is an object representing a voucher. + # This is an object representing a voucher with categories and validation rules assignments. class Voucher # Assigned by the Voucherify API, identifies the voucher. attr_accessor :id @@ -34,9 +34,6 @@ class Voucher # Unique category ID assigned by Voucherify. attr_accessor :category_id - # Contains details about the category. - attr_accessor :categories - # Defines the type of the voucher. attr_accessor :type @@ -54,9 +51,11 @@ class Voucher attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher attr_accessor :active @@ -71,31 +70,30 @@ class Voucher # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Timestamp representing the date and time when the voucher was created in ISO 8601 format. + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. attr_accessor :updated_at - # Unique customer ID of voucher owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id - attr_accessor :holder + # Unique identifier of the referring person. + attr_accessor :referrer_id - # The type of object represented by JSON. Default is `voucher`. + # The type of the object represented by JSON. Default is `voucher`. attr_accessor :object - attr_accessor :distributions - - # Flag indicating whether this voucher is deleted. - attr_accessor :deleted - - attr_accessor :validation_rules_assignments - attr_accessor :publish attr_accessor :redemption + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -127,7 +125,6 @@ def self.attribute_map :'campaign_id' => :'campaign_id', :'category' => :'category', :'category_id' => :'category_id', - :'categories' => :'categories', :'type' => :'type', :'discount' => :'discount', :'gift' => :'gift', @@ -136,6 +133,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'active' => :'active', :'additional_info' => :'additional_info', :'metadata' => :'metadata', @@ -144,13 +142,12 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'holder_id' => :'holder_id', - :'holder' => :'holder', + :'referrer_id' => :'referrer_id', :'object' => :'object', - :'distributions' => :'distributions', - :'deleted' => :'deleted', - :'validation_rules_assignments' => :'validation_rules_assignments', :'publish' => :'publish', - :'redemption' => :'redemption' + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' } end @@ -168,15 +165,15 @@ def self.openapi_types :'campaign_id' => :'String', :'category' => :'String', :'category_id' => :'String', - :'categories' => :'Array', :'type' => :'String', :'discount' => :'Discount', :'gift' => :'VoucherGift', :'loyalty_card' => :'VoucherLoyaltyCard', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'VoucherValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'active' => :'Boolean', :'additional_info' => :'String', :'metadata' => :'Object', @@ -185,36 +182,49 @@ def self.openapi_types :'created_at' => :'Time', :'updated_at' => :'Time', :'holder_id' => :'String', - :'holder' => :'SimpleCustomer', + :'referrer_id' => :'String', :'object' => :'String', - :'distributions' => :'Array', - :'deleted' => :'Boolean', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', :'publish' => :'VoucherPublish', - :'redemption' => :'VoucherRedemption' + :'redemption' => :'VoucherRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', :'active', + :'additional_info', + :'metadata', :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Voucher` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Voucher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -242,12 +252,6 @@ def initialize(attributes = {}) self.category_id = attributes[:'category_id'] end - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -282,6 +286,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'active') self.active = attributes[:'active'] end @@ -314,8 +322,8 @@ def initialize(attributes = {}) self.holder_id = attributes[:'holder_id'] end - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'object') @@ -324,20 +332,6 @@ def initialize(attributes = {}) self.object = 'voucher' end - if attributes.key?(:'distributions') - if (value = attributes[:'distributions']).is_a?(Array) - self.distributions = value - end - end - - if attributes.key?(:'deleted') - self.deleted = attributes[:'deleted'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - if attributes.key?(:'publish') self.publish = attributes[:'publish'] end @@ -345,6 +339,16 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -364,16 +368,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -385,7 +379,6 @@ def ==(o) campaign_id == o.campaign_id && category == o.category && category_id == o.category_id && - categories == o.categories && type == o.type && discount == o.discount && gift == o.gift && @@ -394,6 +387,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && active == o.active && additional_info == o.additional_info && metadata == o.metadata && @@ -402,13 +396,12 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && holder_id == o.holder_id && - holder == o.holder && + referrer_id == o.referrer_id && object == o.object && - distributions == o.distributions && - deleted == o.deleted && - validation_rules_assignments == o.validation_rules_assignments && publish == o.publish && - redemption == o.redemption + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments end # @see the `==` method @@ -420,7 +413,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, holder, object, distributions, deleted, validation_rules_assignments, publish, redemption].hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/voucher_assets.rb b/lib/VoucherifySdk/models/voucher_assets.rb index 531f08c9..2b17f65e 100644 --- a/lib/VoucherifySdk/models/voucher_assets.rb +++ b/lib/VoucherifySdk/models/voucher_assets.rb @@ -36,29 +36,24 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'qr' => :'LoyaltiesMembersTransfersCreateResponseBodyAssetsQr', - :'barcode' => :'LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode' + :'qr' => :'VoucherAssetsQr', + :'barcode' => :'VoucherAssetsBarcode' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'qr', + :'barcode' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherAssets` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherAssets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/voucher_assets_barcode.rb b/lib/VoucherifySdk/models/voucher_assets_barcode.rb new file mode 100644 index 00000000..0dcb6a2d --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_assets_barcode.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores barcode representation of encrypted code. + class VoucherAssetsBarcode + # Encrypted voucher code ID. + attr_accessor :id + + # URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher_assets_qr.rb b/lib/VoucherifySdk/models/voucher_assets_qr.rb new file mode 100644 index 00000000..9e1f7927 --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_assets_qr.rb @@ -0,0 +1,221 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores Quick Response (QR) representation of encrypted code. + class VoucherAssetsQr + # Encrypted voucher code ID. + attr_accessor :id + + # URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher_gift.rb b/lib/VoucherifySdk/models/voucher_gift.rb index eb71ca68..f4a33e3b 100644 --- a/lib/VoucherifySdk/models/voucher_gift.rb +++ b/lib/VoucherifySdk/models/voucher_gift.rb @@ -73,21 +73,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'amount', + :'balance', + :'effect' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherGift` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -121,16 +117,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] effect Object to be assigned - def effect=(effect) - validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) - unless validator.valid?(effect) - fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}." - end - @effect = effect - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/voucher_loyalty_card.rb b/lib/VoucherifySdk/models/voucher_loyalty_card.rb index 9a4c960b..a52dba36 100644 --- a/lib/VoucherifySdk/models/voucher_loyalty_card.rb +++ b/lib/VoucherifySdk/models/voucher_loyalty_card.rb @@ -16,7 +16,7 @@ module VoucherifySdk # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. class VoucherLoyaltyCard - # Total points incurred over lifespan of loyalty card. + # Total points incurred over the lifespan of the loyalty card. attr_accessor :points # Points available for reward redemption. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherLoyaltyCard` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherLoyaltyCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/voucher_publish.rb b/lib/VoucherifySdk/models/voucher_publish.rb index e3bcf1d8..15ea7cda 100644 --- a/lib/VoucherifySdk/models/voucher_publish.rb +++ b/lib/VoucherifySdk/models/voucher_publish.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. class VoucherPublish - # The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. attr_accessor :object # Publication events counter. @@ -51,21 +51,17 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'count', + :'url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherPublish` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherPublish`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/voucher_redemption.rb b/lib/VoucherifySdk/models/voucher_redemption.rb index e5c0e52a..b1a2183f 100644 --- a/lib/VoucherifySdk/models/voucher_redemption.rb +++ b/lib/VoucherifySdk/models/voucher_redemption.rb @@ -22,13 +22,10 @@ class VoucherRedemption # How many times a voucher has already been redeemed. attr_accessor :redeemed_quantity - # Total amount redeemed. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 balance is written as 10000. - attr_accessor :redeemed_amount - # Total loyalty points redeemed. attr_accessor :redeemed_points - # The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. attr_accessor :object # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` @@ -39,7 +36,6 @@ def self.attribute_map { :'quantity' => :'quantity', :'redeemed_quantity' => :'redeemed_quantity', - :'redeemed_amount' => :'redeemed_amount', :'redeemed_points' => :'redeemed_points', :'object' => :'object', :'url' => :'url' @@ -56,7 +52,6 @@ def self.openapi_types { :'quantity' => :'Integer', :'redeemed_quantity' => :'Integer', - :'redeemed_amount' => :'Integer', :'redeemed_points' => :'Integer', :'object' => :'String', :'url' => :'String' @@ -66,21 +61,19 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherRedemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -92,10 +85,6 @@ def initialize(attributes = {}) self.redeemed_quantity = attributes[:'redeemed_quantity'] end - if attributes.key?(:'redeemed_amount') - self.redeemed_amount = attributes[:'redeemed_amount'] - end - if attributes.key?(:'redeemed_points') self.redeemed_points = attributes[:'redeemed_points'] end @@ -133,7 +122,6 @@ def ==(o) self.class == o.class && quantity == o.quantity && redeemed_quantity == o.redeemed_quantity && - redeemed_amount == o.redeemed_amount && redeemed_points == o.redeemed_points && object == o.object && url == o.url @@ -148,7 +136,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [quantity, redeemed_quantity, redeemed_amount, redeemed_points, object, url].hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/voucher_transaction.rb b/lib/VoucherifySdk/models/voucher_transaction.rb index 51ebfb76..f5391519 100644 --- a/lib/VoucherifySdk/models/voucher_transaction.rb +++ b/lib/VoucherifySdk/models/voucher_transaction.rb @@ -18,7 +18,7 @@ class VoucherTransaction # Unique transaction ID. attr_accessor :id - # The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. + # The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. attr_accessor :source_id # Unique voucher ID. @@ -40,7 +40,7 @@ class VoucherTransaction # The related transaction ID on the receiving card. attr_accessor :related_transaction_id - # Timestamp representing the date and time when the transaction was created in ISO 8601 format. + # Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. attr_accessor :created_at class EnumAttributeValidator @@ -105,62 +105,48 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', :'source_id', + :'voucher_id', + :'campaign_id', :'source', :'reason', + :'details', :'related_transaction_id', + :'created_at' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransaction` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end if attributes.key?(:'voucher_id') self.voucher_id = attributes[:'voucher_id'] - else - self.voucher_id = nil end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] - else - self.campaign_id = nil end if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end if attributes.key?(:'reason') self.reason = attributes[:'reason'] - else - self.reason = nil end if attributes.key?(:'type') @@ -171,20 +157,14 @@ def initialize(attributes = {}) if attributes.key?(:'details') self.details = attributes[:'details'] - else - self.details = nil end if attributes.key?(:'related_transaction_id') self.related_transaction_id = attributes[:'related_transaction_id'] - else - self.related_transaction_id = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end end @@ -193,30 +173,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @voucher_id.nil? - invalid_properties.push('invalid value for "voucher_id", voucher_id cannot be nil.') - end - - if @campaign_id.nil? - invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.') - end - if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end - if @details.nil? - invalid_properties.push('invalid value for "details", details cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - invalid_properties end @@ -224,12 +184,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @voucher_id.nil? - return false if @campaign_id.nil? return false if @type.nil? - return false if @details.nil? - return false if @created_at.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details.rb b/lib/VoucherifySdk/models/voucher_transaction_details.rb index dcef3b7d..7aac8037 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details.rb @@ -88,21 +88,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'balance', + :'order', + :'event', + :'earning_rule', + :'segment', + :'loyalty_tier', + :'redemption', + :'rollback', + :'custom_event', + :'event_schema', + :'reward', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetails` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_balance.rb b/lib/VoucherifySdk/models/voucher_transaction_details_balance.rb index cb41c502..ec5e1d4c 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_balance.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_balance.rb @@ -19,16 +19,16 @@ class VoucherTransactionDetailsBalance # The type of voucher whose balance is being adjusted due to the transaction. attr_accessor :type - # The available points prior to the transaction. + # The number of all points accumulated on the card as affected by add or subtract operations. attr_accessor :total - # The type of object represented by the JSON. + # The type of the object represented by the JSON. attr_accessor :object - # The amount of points being used up in the transaction. + # Points added or subtracted in the transaction. attr_accessor :points - # The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card. + # The available points on the card after the transaction as affected by redemption or rollback. attr_accessor :balance attr_accessor :related_object @@ -87,21 +87,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'total', + :'object', + :'points', + :'balance', + :'related_object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsBalance` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -113,8 +112,6 @@ def initialize(attributes = {}) if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'object') @@ -125,20 +122,14 @@ def initialize(attributes = {}) if attributes.key?(:'points') self.points = attributes[:'points'] - else - self.points = nil end if attributes.key?(:'balance') self.balance = attributes[:'balance'] - else - self.balance = nil end if attributes.key?(:'related_object') self.related_object = attributes[:'related_object'] - else - self.related_object = nil end end @@ -147,40 +138,16 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - pattern = Regexp.new(/loyalty_card/) - if @type !~ pattern + if !@type.nil? && @type !~ pattern invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.") end - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - pattern = Regexp.new(/balance/) - if @object !~ pattern + if !@object.nil? && @object !~ pattern invalid_properties.push("invalid value for \"object\", must conform to the pattern #{pattern}.") end - if @points.nil? - invalid_properties.push('invalid value for "points", points cannot be nil.') - end - - if @balance.nil? - invalid_properties.push('invalid value for "balance", balance cannot be nil.') - end - - if @related_object.nil? - invalid_properties.push('invalid value for "related_object", related_object cannot be nil.') - end - invalid_properties end @@ -188,41 +155,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["loyalty_card"]) return false unless type_validator.valid?(@type) - return false if @type !~ Regexp.new(/loyalty_card/) - return false if @total.nil? - return false if @object.nil? + return false if !@type.nil? && @type !~ Regexp.new(/loyalty_card/) object_validator = EnumAttributeValidator.new('String', ["balance"]) return false unless object_validator.valid?(@object) - return false if @object !~ Regexp.new(/balance/) - return false if @points.nil? - return false if @balance.nil? - return false if @related_object.nil? + return false if !@object.nil? && @object !~ Regexp.new(/balance/) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["loyalty_card"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["balance"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_balance_related_object.rb b/lib/VoucherifySdk/models/voucher_transaction_details_balance_related_object.rb index 241d1b6c..a59cdf81 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_balance_related_object.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_balance_related_object.rb @@ -68,28 +68,21 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsBalanceRelatedObject` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsBalanceRelatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'type') @@ -104,16 +97,8 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - pattern = Regexp.new(/voucher/) - if @type !~ pattern + if !@type.nil? && @type !~ pattern invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.") end @@ -124,24 +109,12 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["voucher"]) return false unless type_validator.valid?(@type) - return false if @type !~ Regexp.new(/voucher/) + return false if !@type.nil? && @type !~ Regexp.new(/voucher/) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_custom_event.rb b/lib/VoucherifySdk/models/voucher_transaction_details_custom_event.rb index 1772ad3c..a2f87203 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_custom_event.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_custom_event.rb @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsCustomEvent` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsCustomEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @type.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule.rb b/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule.rb index a1a707eb..85a1ab75 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule.rb @@ -45,34 +45,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsEarningRule` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsEarningRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source') self.source = attributes[:'source'] - else - self.source = nil end end @@ -81,14 +72,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @source.nil? - invalid_properties.push('invalid value for "source", source cannot be nil.') - end - invalid_properties end @@ -96,8 +79,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @source.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule_source.rb b/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule_source.rb index a536d8a1..43885769 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule_source.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule_source.rb @@ -41,28 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'banner' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsEarningRuleSource` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsEarningRuleSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'banner') self.banner = attributes[:'banner'] - else - self.banner = nil end end @@ -71,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @banner.nil? - invalid_properties.push('invalid value for "banner", banner cannot be nil.') - end - invalid_properties end @@ -82,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @banner.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_event.rb b/lib/VoucherifySdk/models/voucher_transaction_details_event.rb index 4b0574f1..4a28d6ec 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_event.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_event.rb @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'type' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsEvent` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @type.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_event_schema.rb b/lib/VoucherifySdk/models/voucher_transaction_details_event_schema.rb index 34098af9..1b27a3bd 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_event_schema.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_event_schema.rb @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsEventSchema` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsEventSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_loyalty_tier.rb b/lib/VoucherifySdk/models/voucher_transaction_details_loyalty_tier.rb index b334f89b..9e0e9917 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_loyalty_tier.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_loyalty_tier.rb @@ -44,34 +44,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsLoyaltyTier` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsLoyaltyTier`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end end @@ -80,14 +71,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -95,8 +78,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_order.rb b/lib/VoucherifySdk/models/voucher_transaction_details_order.rb index b54901cf..d178ef50 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_order.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_order.rb @@ -19,7 +19,7 @@ class VoucherTransactionDetailsOrder # Unique order ID. attr_accessor :id - # The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. + # The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. attr_accessor :source_id # Attribute mapping from ruby-style variable name to JSON key. @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'source_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsOrder` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] - else - self.source_id = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @source_id.nil? - invalid_properties.push('invalid value for "source_id", source_id cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @source_id.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_redemption.rb b/lib/VoucherifySdk/models/voucher_transaction_details_redemption.rb index 4bd3c2d0..faa268c1 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_redemption.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_redemption.rb @@ -41,28 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsRedemption` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsRedemption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end end @@ -71,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - invalid_properties end @@ -82,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_reward.rb b/lib/VoucherifySdk/models/voucher_transaction_details_reward.rb index 989d1043..a5e523b3 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_reward.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_reward.rb @@ -46,34 +46,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsReward` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end end @@ -82,14 +73,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -97,8 +80,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_rollback.rb b/lib/VoucherifySdk/models/voucher_transaction_details_rollback.rb index 5d057532..647a15f1 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_rollback.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_rollback.rb @@ -41,28 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsRollback` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsRollback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end end @@ -71,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - invalid_properties end @@ -82,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transaction_details_segment.rb b/lib/VoucherifySdk/models/voucher_transaction_details_segment.rb index 8adbd0b8..cae3f1ef 100644 --- a/lib/VoucherifySdk/models/voucher_transaction_details_segment.rb +++ b/lib/VoucherifySdk/models/voucher_transaction_details_segment.rb @@ -44,34 +44,25 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'name' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionDetailsSegment` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionDetailsSegment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end end @@ -80,14 +71,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - invalid_properties end @@ -95,8 +78,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @name.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transactions_export.rb b/lib/VoucherifySdk/models/voucher_transactions_export.rb deleted file mode 100644 index 8c53429f..00000000 --- a/lib/VoucherifySdk/models/voucher_transactions_export.rb +++ /dev/null @@ -1,407 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # This is an object representing an export. Using this endpoint, you can export voucher transactions as a CSV file. This functionality works asynchronously and comes down to the following steps: create an export object and return its id so you can track its status, trigger a CSV file generation, change the status to SCHEDULED when the generation is over, store the file in S3 and change the status to DONE. Now you can download it. With parameters you can select which fields will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks. - class VoucherTransactionsExport - # Unique export ID. - attr_accessor :id - - # The type of object being represented. This object stores information about the `export`. - attr_accessor :object - - # Timestamp representing the date and time when the export was scheduled in ISO 8601 format. - attr_accessor :created_at - - # Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. - attr_accessor :status - - # The channel through which the export was triggered. - attr_accessor :channel - - # The type of exported object. - attr_accessor :exported_object - - attr_accessor :parameters - - attr_accessor :result - - # Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. - attr_accessor :user_id - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'object' => :'object', - :'created_at' => :'created_at', - :'status' => :'status', - :'channel' => :'channel', - :'exported_object' => :'exported_object', - :'parameters' => :'parameters', - :'result' => :'result', - :'user_id' => :'user_id' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'String', - :'object' => :'String', - :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', - :'exported_object' => :'String', - :'parameters' => :'VoucherTransactionsFilters', - :'result' => :'VoucherTransactionsExportResult', - :'user_id' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'result', - :'user_id' - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsExport` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsExport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'id') - self.id = attributes[:'id'] - else - self.id = nil - end - - if attributes.key?(:'object') - self.object = attributes[:'object'] - else - self.object = 'export' - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - else - self.created_at = nil - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - else - self.status = 'SCHEDULED' - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - else - self.channel = 'API' - end - - if attributes.key?(:'exported_object') - self.exported_object = attributes[:'exported_object'] - else - self.exported_object = 'voucher_transactions' - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - else - self.parameters = nil - end - - if attributes.key?(:'result') - self.result = attributes[:'result'] - else - self.result = nil - end - - if attributes.key?(:'user_id') - self.user_id = attributes[:'user_id'] - else - self.user_id = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - - if @parameters.nil? - invalid_properties.push('invalid value for "parameters", parameters cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? - object_validator = EnumAttributeValidator.new('String', ["export"]) - return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - return false unless status_validator.valid?(@status) - return false if @channel.nil? - return false if @exported_object.nil? - exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - return false unless exported_object_validator.valid?(@exported_object) - return false if @parameters.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - object == o.object && - created_at == o.created_at && - status == o.status && - channel == o.channel && - exported_object == o.exported_object && - parameters == o.parameters && - result == o.result && - user_id == o.user_id - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, object, created_at, status, channel, exported_object, parameters, result, user_id].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions.rb b/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions.rb index d2672184..034e7344 100644 --- a/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions.rb +++ b/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions.rb @@ -40,28 +40,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'voucher_id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsExportFilterConditions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsExportFilterConditions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'voucher_id') self.voucher_id = attributes[:'voucher_id'] - else - self.voucher_id = nil end end @@ -70,10 +62,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @voucher_id.nil? - invalid_properties.push('invalid value for "voucher_id", voucher_id cannot be nil.') - end - invalid_properties end @@ -81,7 +69,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @voucher_id.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id.rb b/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id.rb index c21643e7..6c9e4af6 100644 --- a/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id.rb +++ b/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Data filters used to narrow the data records to be returned in the result. + # Data filters used to narrow down the data records to be returned in the result. class VoucherTransactionsExportFilterConditionsVoucherId attr_accessor :conditions @@ -40,28 +40,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'conditions' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsExportFilterConditionsVoucherId` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsExportFilterConditionsVoucherId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'conditions') self.conditions = attributes[:'conditions'] - else - self.conditions = nil end end @@ -70,10 +62,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @conditions.nil? - invalid_properties.push('invalid value for "conditions", conditions cannot be nil.') - end - invalid_properties end @@ -81,7 +69,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @conditions.nil? true end diff --git a/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.rb b/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.rb index ad73fcd3..53032791 100644 --- a/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.rb +++ b/lib/VoucherifySdk/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Data filters used to narrow the data records to be returned in the result. + # Data filters used to narrow down the data records to be returned in the result. class VoucherTransactionsExportFilterConditionsVoucherIdConditions attr_accessor :_in @@ -40,21 +40,15 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'_in' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsExportFilterConditionsVoucherIdConditions` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsExportFilterConditionsVoucherIdConditions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -62,8 +56,6 @@ def initialize(attributes = {}) if (value = attributes[:'_in']).is_a?(Array) self._in = value end - else - self._in = nil end end @@ -72,15 +64,11 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @_in.nil? - invalid_properties.push('invalid value for "_in", _in cannot be nil.') - end - - if @_in.length > 1 + if !@_in.nil? && @_in.length > 1 invalid_properties.push('invalid value for "_in", number of items must be less than or equal to 1.') end - if @_in.length < 1 + if !@_in.nil? && @_in.length < 1 invalid_properties.push('invalid value for "_in", number of items must be greater than or equal to 1.') end @@ -91,30 +79,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @_in.nil? - return false if @_in.length > 1 - return false if @_in.length < 1 + return false if !@_in.nil? && @_in.length > 1 + return false if !@_in.nil? && @_in.length < 1 true end - # Custom attribute writer method with validation - # @param [Object] _in Value to be assigned - def _in=(_in) - if _in.nil? - fail ArgumentError, '_in cannot be nil' - end - - if _in.length > 1 - fail ArgumentError, 'invalid value for "_in", number of items must be less than or equal to 1.' - end - - if _in.length < 1 - fail ArgumentError, 'invalid value for "_in", number of items must be greater than or equal to 1.' - end - - @_in = _in - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/voucher_transactions_export_parameters.rb b/lib/VoucherifySdk/models/voucher_transactions_export_parameters.rb index b0671830..d2612fec 100644 --- a/lib/VoucherifySdk/models/voucher_transactions_export_parameters.rb +++ b/lib/VoucherifySdk/models/voucher_transactions_export_parameters.rb @@ -19,7 +19,7 @@ class VoucherTransactionsExportParameters # How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. attr_accessor :order - # Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_CANCELLATION`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | + # Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | attr_accessor :fields class EnumAttributeValidator @@ -68,21 +68,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'order', + :'fields' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsExportParameters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsExportParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -114,16 +109,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] order Object to be assigned - def order=(order) - validator = EnumAttributeValidator.new('String', ["-created_at", "created_at"]) - unless validator.valid?(order) - fail ArgumentError, "invalid value for \"order\", must be one of #{validator.allowable_values}." - end - @order = order - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/voucher_transactions_export_result.rb b/lib/VoucherifySdk/models/voucher_transactions_export_result.rb deleted file mode 100644 index 7c277479..00000000 --- a/lib/VoucherifySdk/models/voucher_transactions_export_result.rb +++ /dev/null @@ -1,223 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Contains the URL of the CSV file. - class VoucherTransactionsExportResult - # URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method. - attr_accessor :url - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'url' => :'url' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'url' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsExportResult` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsExportResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'url') - self.url = attributes[:'url'] - else - self.url = nil - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if @url.nil? - invalid_properties.push('invalid value for "url", url cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @url.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - url == o.url - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [url].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/voucher_transactions_filters.rb b/lib/VoucherifySdk/models/voucher_transactions_filters.rb index f1205db6..12b06dc9 100644 --- a/lib/VoucherifySdk/models/voucher_transactions_filters.rb +++ b/lib/VoucherifySdk/models/voucher_transactions_filters.rb @@ -19,7 +19,7 @@ class VoucherTransactionsFilters # How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. attr_accessor :order - # Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_CANCELLATION`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | + # Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | attr_accessor :fields attr_accessor :filters @@ -72,21 +72,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'order', + :'fields', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherTransactionsFilters` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherTransactionsFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -129,16 +124,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] order Object to be assigned - def order=(order) - validator = EnumAttributeValidator.new('String', ["-created_at", "created_at"]) - unless validator.valid?(order) - fail ArgumentError, "invalid value for \"order\", must be one of #{validator.allowable_values}." - end - @order = order - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/voucher_validity_timeframe.rb b/lib/VoucherifySdk/models/voucher_validity_timeframe.rb deleted file mode 100644 index 31475cd0..00000000 --- a/lib/VoucherifySdk/models/voucher_validity_timeframe.rb +++ /dev/null @@ -1,226 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - # Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`. - class VoucherValidityTimeframe - # Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour. - attr_accessor :duration - - # Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day. - attr_accessor :interval - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'duration' => :'duration', - :'interval' => :'interval' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'duration' => :'String', - :'interval' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VoucherValidityTimeframe` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VoucherValidityTimeframe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end - h[k.to_sym] = v - } - - if attributes.key?(:'duration') - self.duration = attributes[:'duration'] - end - - if attributes.key?(:'interval') - self.interval = attributes[:'interval'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - duration == o.duration && - interval == o.interval - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [duration, interval].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = VoucherifySdk.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/VoucherifySdk/models/voucher_with_categories.rb b/lib/VoucherifySdk/models/voucher_with_categories.rb new file mode 100644 index 00000000..31fe071e --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_with_categories.rb @@ -0,0 +1,524 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # This is an object representing a voucher with categories. + class VoucherWithCategories + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'VoucherWithCategoriesGift', + :'loyalty_card' => :'VoucherWithCategoriesLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'VoucherWithCategoriesPublish', + :'redemption' => :'VoucherWithCategoriesRedemption', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher_with_categories_gift.rb b/lib/VoucherifySdk/models/voucher_with_categories_gift.rb new file mode 100644 index 00000000..e2d192ad --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_with_categories_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class VoucherWithCategoriesGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher_with_categories_loyalty_card.rb b/lib/VoucherifySdk/models/voucher_with_categories_loyalty_card.rb new file mode 100644 index 00000000..a75f3511 --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_with_categories_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class VoucherWithCategoriesLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher_with_categories_publish.rb b/lib/VoucherifySdk/models/voucher_with_categories_publish.rb new file mode 100644 index 00000000..87e00f71 --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_with_categories_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class VoucherWithCategoriesPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/voucher_with_categories_redemption.rb b/lib/VoucherifySdk/models/voucher_with_categories_redemption.rb new file mode 100644 index 00000000..8722d50d --- /dev/null +++ b/lib/VoucherifySdk/models/voucher_with_categories_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class VoucherWithCategoriesRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_balance_update_request_body.rb b/lib/VoucherifySdk/models/vouchers_balance_update_request_body.rb index efed8f2f..4a26504f 100644 --- a/lib/VoucherifySdk/models/vouchers_balance_update_request_body.rb +++ b/lib/VoucherifySdk/models/vouchers_balance_update_request_body.rb @@ -19,7 +19,7 @@ class VouchersBalanceUpdateRequestBody # The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000. attr_accessor :amount - # The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. + # The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. attr_accessor :source_id # Reason why the transaction occurred. @@ -51,28 +51,22 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'amount', + :'source_id', + :'reason' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersBalanceUpdateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersBalanceUpdateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'amount') self.amount = attributes[:'amount'] - else - self.amount = nil end if attributes.key?(:'source_id') @@ -89,10 +83,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @amount.nil? - invalid_properties.push('invalid value for "amount", amount cannot be nil.') - end - invalid_properties end @@ -100,7 +90,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @amount.nil? true end diff --git a/lib/VoucherifySdk/models/vouchers_balance_update_response_body.rb b/lib/VoucherifySdk/models/vouchers_balance_update_response_body.rb index d8285de4..7813bdad 100644 --- a/lib/VoucherifySdk/models/vouchers_balance_update_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_balance_update_response_body.rb @@ -30,7 +30,7 @@ class VouchersBalanceUpdateResponseBody attr_accessor :operation_type - # The type of object represented by JSON. Default is `balance`. + # The type of the object represented by JSON. Default is `balance`. attr_accessor :object attr_accessor :related_object @@ -91,46 +91,38 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'amount', + :'total', + :'balance', + :'type', + :'operation_type', + :'object', + :'related_object' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersBalanceUpdateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersBalanceUpdateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'amount') self.amount = attributes[:'amount'] - else - self.amount = nil end if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'balance') self.balance = attributes[:'balance'] - else - self.balance = nil end if attributes.key?(:'type') self.type = attributes[:'type'] - else - self.type = nil end if attributes.key?(:'operation_type') @@ -147,8 +139,6 @@ def initialize(attributes = {}) if attributes.key?(:'related_object') self.related_object = attributes[:'related_object'] - else - self.related_object = nil end end @@ -157,34 +147,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @amount.nil? - invalid_properties.push('invalid value for "amount", amount cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - - if @balance.nil? - invalid_properties.push('invalid value for "balance", balance cannot be nil.') - end - - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @operation_type.nil? - invalid_properties.push('invalid value for "operation_type", operation_type cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @related_object.nil? - invalid_properties.push('invalid value for "related_object", related_object cannot be nil.') - end - invalid_properties end @@ -192,52 +154,15 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @amount.nil? - return false if @total.nil? - return false if @balance.nil? - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["gift_voucher", "loyalty_card"]) return false unless type_validator.valid?(@type) - return false if @operation_type.nil? operation_type_validator = EnumAttributeValidator.new('String', ["MANUAL"]) return false unless operation_type_validator.valid?(@operation_type) - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["balance"]) return false unless object_validator.valid?(@object) - return false if @related_object.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["gift_voucher", "loyalty_card"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] operation_type Object to be assigned - def operation_type=(operation_type) - validator = EnumAttributeValidator.new('String', ["MANUAL"]) - unless validator.valid?(operation_type) - fail ArgumentError, "invalid value for \"operation_type\", must be one of #{validator.allowable_values}." - end - @operation_type = operation_type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["balance"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/vouchers_balance_update_response_body_related_object.rb b/lib/VoucherifySdk/models/vouchers_balance_update_response_body_related_object.rb index b50159a0..73cc44fe 100644 --- a/lib/VoucherifySdk/models/vouchers_balance_update_response_body_related_object.rb +++ b/lib/VoucherifySdk/models/vouchers_balance_update_response_body_related_object.rb @@ -68,21 +68,16 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'type', + :'id' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersBalanceUpdateResponseBodyRelatedObject` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersBalanceUpdateResponseBodyRelatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -94,8 +89,6 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end end @@ -104,14 +97,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') - end - - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - invalid_properties end @@ -119,23 +104,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["voucher"]) return false unless type_validator.valid?(@type) - return false if @id.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["voucher"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/vouchers_create_response_body.rb b/lib/VoucherifySdk/models/vouchers_create_response_body.rb new file mode 100644 index 00000000..d562bd45 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_response_body.rb @@ -0,0 +1,533 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/vouchers` and `/vouchers/{code}` + class VouchersCreateResponseBody + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'VouchersCreateResponseBodyGift', + :'loyalty_card' => :'VouchersCreateResponseBodyLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'VouchersCreateResponseBodyPublish', + :'redemption' => :'VouchersCreateResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_create_response_body_gift.rb b/lib/VoucherifySdk/models/vouchers_create_response_body_gift.rb new file mode 100644 index 00000000..f6704795 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class VouchersCreateResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_create_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/vouchers_create_response_body_loyalty_card.rb new file mode 100644 index 00000000..f9bacb25 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class VouchersCreateResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_create_response_body_publish.rb b/lib/VoucherifySdk/models/vouchers_create_response_body_publish.rb new file mode 100644 index 00000000..1f9ac147 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class VouchersCreateResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_create_response_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_create_response_body_redemption.rb new file mode 100644 index 00000000..93b21985 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class VouchersCreateResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body.rb b/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body.rb new file mode 100644 index 00000000..d142e2c3 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body.rb @@ -0,0 +1,410 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class VouchersCreateWithSpecificCodeRequestBody + # Identifies the voucher's parent campaign using a unique campaign name. + attr_accessor :campaign + + # Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API. + attr_accessor :campaign_id + + # The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + attr_accessor :category + + # Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + attr_accessor :category_id + + # Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + attr_accessor :metadata + + # Array containing the ID of the validation rule associated with the voucher. + attr_accessor :validation_rules + + attr_accessor :redemption + + attr_accessor :type + + attr_accessor :loyalty_card + + attr_accessor :gift + + attr_accessor :discount + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'validation_rules' => :'validation_rules', + :'redemption' => :'redemption', + :'type' => :'type', + :'loyalty_card' => :'loyalty_card', + :'gift' => :'gift', + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'validation_rules' => :'Array', + :'redemption' => :'VouchersCreateWithSpecificCodeRequestBodyRedemption', + :'type' => :'String', + :'loyalty_card' => :'SimpleLoyaltyCard', + :'gift' => :'Gift', + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'validation_rules', + :'redemption', + :'type', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'validation_rules') + if (value = attributes[:'validation_rules']).is_a?(Array) + self.validation_rules = value + end + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD", "GIFT_VOUCHER", "DISCOUNT_VOUCHER"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + validation_rules == o.validation_rules && + redemption == o.redemption && + type == o.type && + loyalty_card == o.loyalty_card && + gift == o.gift && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign, campaign_id, category, category_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, validation_rules, redemption, type, loyalty_card, gift, discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body_redemption.rb new file mode 100644 index 00000000..9c700f42 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_create_with_specific_code_request_body_redemption.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class VouchersCreateWithSpecificCodeRequestBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_disable_response_body.rb b/lib/VoucherifySdk/models/vouchers_disable_response_body.rb index 21212271..9bf0ddf4 100644 --- a/lib/VoucherifySdk/models/vouchers_disable_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_disable_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/vouchers/{code}/disable`. + # Response body schema for **POST** `v1/vouchers/{code}/disable`. class VouchersDisableResponseBody # Assigned by the Voucherify API, identifies the voucher. attr_accessor :id @@ -34,9 +34,6 @@ class VouchersDisableResponseBody # Unique category ID assigned by Voucherify. attr_accessor :category_id - # Contains details about the category. - attr_accessor :categories - # Defines the type of the voucher. attr_accessor :type @@ -54,9 +51,11 @@ class VouchersDisableResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher attr_accessor :active @@ -71,31 +70,30 @@ class VouchersDisableResponseBody # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Timestamp representing the date and time when the voucher was created in ISO 8601 format. + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. attr_accessor :updated_at - # Unique customer ID of voucher owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id - attr_accessor :holder + # Unique identifier of the referring person. + attr_accessor :referrer_id - # The type of object represented by JSON. Default is `voucher`. + # The type of the object represented by JSON. Default is `voucher`. attr_accessor :object - attr_accessor :distributions - - # Flag indicating whether this voucher is deleted. - attr_accessor :deleted - - attr_accessor :validation_rules_assignments - attr_accessor :publish attr_accessor :redemption + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -127,7 +125,6 @@ def self.attribute_map :'campaign_id' => :'campaign_id', :'category' => :'category', :'category_id' => :'category_id', - :'categories' => :'categories', :'type' => :'type', :'discount' => :'discount', :'gift' => :'gift', @@ -136,6 +133,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'active' => :'active', :'additional_info' => :'additional_info', :'metadata' => :'metadata', @@ -144,13 +142,12 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'holder_id' => :'holder_id', - :'holder' => :'holder', + :'referrer_id' => :'referrer_id', :'object' => :'object', - :'distributions' => :'distributions', - :'deleted' => :'deleted', - :'validation_rules_assignments' => :'validation_rules_assignments', :'publish' => :'publish', - :'redemption' => :'redemption' + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' } end @@ -168,15 +165,15 @@ def self.openapi_types :'campaign_id' => :'String', :'category' => :'String', :'category_id' => :'String', - :'categories' => :'Array', :'type' => :'String', :'discount' => :'Discount', - :'gift' => :'VoucherGift', - :'loyalty_card' => :'VoucherLoyaltyCard', + :'gift' => :'VouchersDisableResponseBodyGift', + :'loyalty_card' => :'VouchersDisableResponseBodyLoyaltyCard', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'VoucherValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'active' => :'Boolean', :'additional_info' => :'String', :'metadata' => :'Object', @@ -185,43 +182,49 @@ def self.openapi_types :'created_at' => :'Time', :'updated_at' => :'Time', :'holder_id' => :'String', - :'holder' => :'SimpleCustomer', + :'referrer_id' => :'String', :'object' => :'String', - :'distributions' => :'Array', - :'deleted' => :'Boolean', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', - :'publish' => :'VoucherPublish', - :'redemption' => :'VoucherRedemption' + :'publish' => :'VouchersDisableResponseBodyPublish', + :'redemption' => :'VouchersDisableResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', :'active', + :'additional_info', + :'metadata', :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Voucher' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersDisableResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersDisableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -249,12 +252,6 @@ def initialize(attributes = {}) self.category_id = attributes[:'category_id'] end - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -289,6 +286,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'active') self.active = attributes[:'active'] end @@ -321,8 +322,8 @@ def initialize(attributes = {}) self.holder_id = attributes[:'holder_id'] end - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'object') @@ -331,20 +332,6 @@ def initialize(attributes = {}) self.object = 'voucher' end - if attributes.key?(:'distributions') - if (value = attributes[:'distributions']).is_a?(Array) - self.distributions = value - end - end - - if attributes.key?(:'deleted') - self.deleted = attributes[:'deleted'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - if attributes.key?(:'publish') self.publish = attributes[:'publish'] end @@ -352,6 +339,16 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -371,16 +368,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -392,7 +379,6 @@ def ==(o) campaign_id == o.campaign_id && category == o.category && category_id == o.category_id && - categories == o.categories && type == o.type && discount == o.discount && gift == o.gift && @@ -401,6 +387,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && active == o.active && additional_info == o.additional_info && metadata == o.metadata && @@ -409,13 +396,12 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && holder_id == o.holder_id && - holder == o.holder && + referrer_id == o.referrer_id && object == o.object && - distributions == o.distributions && - deleted == o.deleted && - validation_rules_assignments == o.validation_rules_assignments && publish == o.publish && - redemption == o.redemption + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments end # @see the `==` method @@ -427,7 +413,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, holder, object, distributions, deleted, validation_rules_assignments, publish, redemption].hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/vouchers_disable_response_body_gift.rb b/lib/VoucherifySdk/models/vouchers_disable_response_body_gift.rb new file mode 100644 index 00000000..95d83428 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_disable_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class VouchersDisableResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_disable_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/vouchers_disable_response_body_loyalty_card.rb new file mode 100644 index 00000000..a68af866 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_disable_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class VouchersDisableResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_disable_response_body_publish.rb b/lib/VoucherifySdk/models/vouchers_disable_response_body_publish.rb new file mode 100644 index 00000000..ae09f103 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_disable_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class VouchersDisableResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_disable_response_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_disable_response_body_redemption.rb new file mode 100644 index 00000000..ec6eb241 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_disable_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class VouchersDisableResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_enable_response_body.rb b/lib/VoucherifySdk/models/vouchers_enable_response_body.rb index fa207a2a..8bf103c1 100644 --- a/lib/VoucherifySdk/models/vouchers_enable_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_enable_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/vouchers/{code}/enable`. + # Response body schema for **POST** `v1/vouchers/{code}/enable`. class VouchersEnableResponseBody # Assigned by the Voucherify API, identifies the voucher. attr_accessor :id @@ -34,9 +34,6 @@ class VouchersEnableResponseBody # Unique category ID assigned by Voucherify. attr_accessor :category_id - # Contains details about the category. - attr_accessor :categories - # Defines the type of the voucher. attr_accessor :type @@ -54,9 +51,11 @@ class VouchersEnableResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher attr_accessor :active @@ -71,31 +70,30 @@ class VouchersEnableResponseBody # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Timestamp representing the date and time when the voucher was created in ISO 8601 format. + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. attr_accessor :updated_at - # Unique customer ID of voucher owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id - attr_accessor :holder + # Unique identifier of the referring person. + attr_accessor :referrer_id - # The type of object represented by JSON. Default is `voucher`. + # The type of the object represented by JSON. Default is `voucher`. attr_accessor :object - attr_accessor :distributions - - # Flag indicating whether this voucher is deleted. - attr_accessor :deleted - - attr_accessor :validation_rules_assignments - attr_accessor :publish attr_accessor :redemption + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -127,7 +125,6 @@ def self.attribute_map :'campaign_id' => :'campaign_id', :'category' => :'category', :'category_id' => :'category_id', - :'categories' => :'categories', :'type' => :'type', :'discount' => :'discount', :'gift' => :'gift', @@ -136,6 +133,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'active' => :'active', :'additional_info' => :'additional_info', :'metadata' => :'metadata', @@ -144,13 +142,12 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'holder_id' => :'holder_id', - :'holder' => :'holder', + :'referrer_id' => :'referrer_id', :'object' => :'object', - :'distributions' => :'distributions', - :'deleted' => :'deleted', - :'validation_rules_assignments' => :'validation_rules_assignments', :'publish' => :'publish', - :'redemption' => :'redemption' + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' } end @@ -168,15 +165,15 @@ def self.openapi_types :'campaign_id' => :'String', :'category' => :'String', :'category_id' => :'String', - :'categories' => :'Array', :'type' => :'String', :'discount' => :'Discount', - :'gift' => :'VoucherGift', - :'loyalty_card' => :'VoucherLoyaltyCard', + :'gift' => :'VouchersEnableResponseBodyGift', + :'loyalty_card' => :'VouchersEnableResponseBodyLoyaltyCard', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'VoucherValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'active' => :'Boolean', :'additional_info' => :'String', :'metadata' => :'Object', @@ -185,43 +182,49 @@ def self.openapi_types :'created_at' => :'Time', :'updated_at' => :'Time', :'holder_id' => :'String', - :'holder' => :'SimpleCustomer', + :'referrer_id' => :'String', :'object' => :'String', - :'distributions' => :'Array', - :'deleted' => :'Boolean', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', - :'publish' => :'VoucherPublish', - :'redemption' => :'VoucherRedemption' + :'publish' => :'VouchersEnableResponseBodyPublish', + :'redemption' => :'VouchersEnableResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', :'active', + :'additional_info', + :'metadata', :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Voucher' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersEnableResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersEnableResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -249,12 +252,6 @@ def initialize(attributes = {}) self.category_id = attributes[:'category_id'] end - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -289,6 +286,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'active') self.active = attributes[:'active'] end @@ -321,8 +322,8 @@ def initialize(attributes = {}) self.holder_id = attributes[:'holder_id'] end - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'object') @@ -331,20 +332,6 @@ def initialize(attributes = {}) self.object = 'voucher' end - if attributes.key?(:'distributions') - if (value = attributes[:'distributions']).is_a?(Array) - self.distributions = value - end - end - - if attributes.key?(:'deleted') - self.deleted = attributes[:'deleted'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - if attributes.key?(:'publish') self.publish = attributes[:'publish'] end @@ -352,6 +339,16 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -371,16 +368,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -392,7 +379,6 @@ def ==(o) campaign_id == o.campaign_id && category == o.category && category_id == o.category_id && - categories == o.categories && type == o.type && discount == o.discount && gift == o.gift && @@ -401,6 +387,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && active == o.active && additional_info == o.additional_info && metadata == o.metadata && @@ -409,13 +396,12 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && holder_id == o.holder_id && - holder == o.holder && + referrer_id == o.referrer_id && object == o.object && - distributions == o.distributions && - deleted == o.deleted && - validation_rules_assignments == o.validation_rules_assignments && publish == o.publish && - redemption == o.redemption + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments end # @see the `==` method @@ -427,7 +413,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, holder, object, distributions, deleted, validation_rules_assignments, publish, redemption].hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/vouchers_enable_response_body_gift.rb b/lib/VoucherifySdk/models/vouchers_enable_response_body_gift.rb new file mode 100644 index 00000000..02f5a932 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_enable_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class VouchersEnableResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_enable_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/vouchers_enable_response_body_loyalty_card.rb new file mode 100644 index 00000000..2b4ff5a8 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_enable_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class VouchersEnableResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_enable_response_body_publish.rb b/lib/VoucherifySdk/models/vouchers_enable_response_body_publish.rb new file mode 100644 index 00000000..19dc659b --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_enable_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class VouchersEnableResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_enable_response_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_enable_response_body_redemption.rb new file mode 100644 index 00000000..ff2d4b7d --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_enable_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class VouchersEnableResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_get_response_body.rb b/lib/VoucherifySdk/models/vouchers_get_response_body.rb index 4a665ff2..c48aae74 100644 --- a/lib/VoucherifySdk/models/vouchers_get_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/vouchers/{code}`. + # Response body schema for **GET** `v1/vouchers/{code}`. class VouchersGetResponseBody # Assigned by the Voucherify API, identifies the voucher. attr_accessor :id @@ -34,9 +34,6 @@ class VouchersGetResponseBody # Unique category ID assigned by Voucherify. attr_accessor :category_id - # Contains details about the category. - attr_accessor :categories - # Defines the type of the voucher. attr_accessor :type @@ -54,9 +51,11 @@ class VouchersGetResponseBody attr_accessor :validity_timeframe - # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday attr_accessor :validity_day_of_week + attr_accessor :validity_hours + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher attr_accessor :active @@ -71,31 +70,30 @@ class VouchersGetResponseBody # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. attr_accessor :is_referral_code - # Timestamp representing the date and time when the voucher was created in ISO 8601 format. + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. attr_accessor :created_at # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. attr_accessor :updated_at - # Unique customer ID of voucher owner. + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. attr_accessor :holder_id - attr_accessor :holder + # Unique identifier of the referring person. + attr_accessor :referrer_id - # The type of object represented by JSON. Default is `voucher`. + # The type of the object represented by JSON. Default is `voucher`. attr_accessor :object - attr_accessor :distributions - - # Flag indicating whether this voucher is deleted. - attr_accessor :deleted - - attr_accessor :validation_rules_assignments - attr_accessor :publish attr_accessor :redemption + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -127,7 +125,6 @@ def self.attribute_map :'campaign_id' => :'campaign_id', :'category' => :'category', :'category_id' => :'category_id', - :'categories' => :'categories', :'type' => :'type', :'discount' => :'discount', :'gift' => :'gift', @@ -136,6 +133,7 @@ def self.attribute_map :'expiration_date' => :'expiration_date', :'validity_timeframe' => :'validity_timeframe', :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', :'active' => :'active', :'additional_info' => :'additional_info', :'metadata' => :'metadata', @@ -144,13 +142,12 @@ def self.attribute_map :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'holder_id' => :'holder_id', - :'holder' => :'holder', + :'referrer_id' => :'referrer_id', :'object' => :'object', - :'distributions' => :'distributions', - :'deleted' => :'deleted', - :'validation_rules_assignments' => :'validation_rules_assignments', :'publish' => :'publish', - :'redemption' => :'redemption' + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' } end @@ -168,15 +165,15 @@ def self.openapi_types :'campaign_id' => :'String', :'category' => :'String', :'category_id' => :'String', - :'categories' => :'Array', :'type' => :'String', :'discount' => :'Discount', - :'gift' => :'VoucherGift', - :'loyalty_card' => :'VoucherLoyaltyCard', + :'gift' => :'VouchersGetResponseBodyGift', + :'loyalty_card' => :'VouchersGetResponseBodyLoyaltyCard', :'start_date' => :'Time', :'expiration_date' => :'Time', - :'validity_timeframe' => :'VoucherValidityTimeframe', + :'validity_timeframe' => :'ValidityTimeframe', :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', :'active' => :'Boolean', :'additional_info' => :'String', :'metadata' => :'Object', @@ -185,43 +182,49 @@ def self.openapi_types :'created_at' => :'Time', :'updated_at' => :'Time', :'holder_id' => :'String', - :'holder' => :'SimpleCustomer', + :'referrer_id' => :'String', :'object' => :'String', - :'distributions' => :'Array', - :'deleted' => :'Boolean', - :'validation_rules_assignments' => :'ValidationRulesAssignmentsList', - :'publish' => :'VoucherPublish', - :'redemption' => :'VoucherRedemption' + :'publish' => :'VouchersGetResponseBodyPublish', + :'redemption' => :'VouchersGetResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', :'active', + :'additional_info', + :'metadata', :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'Voucher' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -249,12 +252,6 @@ def initialize(attributes = {}) self.category_id = attributes[:'category_id'] end - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -289,6 +286,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + if attributes.key?(:'active') self.active = attributes[:'active'] end @@ -321,8 +322,8 @@ def initialize(attributes = {}) self.holder_id = attributes[:'holder_id'] end - if attributes.key?(:'holder') - self.holder = attributes[:'holder'] + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] end if attributes.key?(:'object') @@ -331,20 +332,6 @@ def initialize(attributes = {}) self.object = 'voucher' end - if attributes.key?(:'distributions') - if (value = attributes[:'distributions']).is_a?(Array) - self.distributions = value - end - end - - if attributes.key?(:'deleted') - self.deleted = attributes[:'deleted'] - end - - if attributes.key?(:'validation_rules_assignments') - self.validation_rules_assignments = attributes[:'validation_rules_assignments'] - end - if attributes.key?(:'publish') self.publish = attributes[:'publish'] end @@ -352,6 +339,16 @@ def initialize(attributes = {}) if attributes.key?(:'redemption') self.redemption = attributes[:'redemption'] end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -371,16 +368,6 @@ def valid? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -392,7 +379,6 @@ def ==(o) campaign_id == o.campaign_id && category == o.category && category_id == o.category_id && - categories == o.categories && type == o.type && discount == o.discount && gift == o.gift && @@ -401,6 +387,7 @@ def ==(o) expiration_date == o.expiration_date && validity_timeframe == o.validity_timeframe && validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && active == o.active && additional_info == o.additional_info && metadata == o.metadata && @@ -409,13 +396,12 @@ def ==(o) created_at == o.created_at && updated_at == o.updated_at && holder_id == o.holder_id && - holder == o.holder && + referrer_id == o.referrer_id && object == o.object && - distributions == o.distributions && - deleted == o.deleted && - validation_rules_assignments == o.validation_rules_assignments && publish == o.publish && - redemption == o.redemption + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments end # @see the `==` method @@ -427,7 +413,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, code, campaign, campaign_id, category, category_id, categories, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, holder, object, distributions, deleted, validation_rules_assignments, publish, redemption].hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash end # Builds the object from hash diff --git a/lib/VoucherifySdk/models/vouchers_get_response_body_gift.rb b/lib/VoucherifySdk/models/vouchers_get_response_body_gift.rb new file mode 100644 index 00000000..83faa7c0 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_get_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class VouchersGetResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_get_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/vouchers_get_response_body_loyalty_card.rb new file mode 100644 index 00000000..334d4343 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_get_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class VouchersGetResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_get_response_body_publish.rb b/lib/VoucherifySdk/models/vouchers_get_response_body_publish.rb new file mode 100644 index 00000000..14b9846d --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_get_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class VouchersGetResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_get_response_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_get_response_body_redemption.rb new file mode 100644 index 00000000..bb05c4fd --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_get_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class VouchersGetResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_import_create_item_request_body.rb b/lib/VoucherifySdk/models/vouchers_import_create_item_request_body.rb new file mode 100644 index 00000000..11c0a283 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_import_create_item_request_body.rb @@ -0,0 +1,357 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class VouchersImportCreateItemRequestBody + # Value representing the imported code. + attr_accessor :code + + attr_accessor :redemption + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + attr_accessor :metadata + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. + attr_accessor :category + + # Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + attr_accessor :start_date + + # Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + attr_accessor :type + + attr_accessor :gift + + attr_accessor :discount + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'redemption' => :'redemption', + :'active' => :'active', + :'metadata' => :'metadata', + :'category' => :'category', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'additional_info' => :'additional_info', + :'type' => :'type', + :'gift' => :'gift', + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'String', + :'redemption' => :'VouchersImportCreateItemRequestBodyRedemption', + :'active' => :'Boolean', + :'metadata' => :'Object', + :'category' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'additional_info' => :'String', + :'type' => :'String', + :'gift' => :'Gift', + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'code', + :'redemption', + :'active', + :'metadata', + :'category', + :'start_date', + :'expiration_date', + :'additional_info', + :'type', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + redemption == o.redemption && + active == o.active && + metadata == o.metadata && + category == o.category && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + additional_info == o.additional_info && + type == o.type && + gift == o.gift && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, redemption, active, metadata, category, start_date, expiration_date, validity_timeframe, validity_day_of_week, additional_info, type, gift, discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_import_create_item_request_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_import_create_item_request_body_redemption.rb new file mode 100644 index 00000000..3bb2b5e3 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_import_create_item_request_body_redemption.rb @@ -0,0 +1,209 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class VouchersImportCreateItemRequestBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_import_create_response_body.rb b/lib/VoucherifySdk/models/vouchers_import_create_response_body.rb new file mode 100644 index 00000000..f9b6e368 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_import_create_response_body.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/vouchers/import`. + class VouchersImportCreateResponseBody + # The ID of the scheduled asynchronous action. + attr_accessor :async_action_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'async_action_id' => :'async_action_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'async_action_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'async_action_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'async_action_id') + self.async_action_id = attributes[:'async_action_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + async_action_id == o.async_action_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [async_action_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_import_csv_create_response_body.rb b/lib/VoucherifySdk/models/vouchers_import_csv_create_response_body.rb index c0197590..9dcc02e8 100644 --- a/lib/VoucherifySdk/models/vouchers_import_csv_create_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_import_csv_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/vouchers/importCSV`. + # Response body schema for **POST** `v1/vouchers/importCSV`. class VouchersImportCsvCreateResponseBody # The ID of the scheduled asynchronous action. attr_accessor :async_action_id @@ -41,35 +41,20 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'async_action_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'AsyncActions' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersImportCsvCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersImportCsvCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'async_action_id') self.async_action_id = attributes[:'async_action_id'] - else - self.async_action_id = nil end end @@ -78,10 +63,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @async_action_id.nil? - invalid_properties.push('invalid value for "async_action_id", async_action_id cannot be nil.') - end - invalid_properties end @@ -89,7 +70,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @async_action_id.nil? true end diff --git a/lib/VoucherifySdk/models/vouchers_list_response_body.rb b/lib/VoucherifySdk/models/vouchers_list_response_body.rb new file mode 100644 index 00000000..e13a6155 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_list_response_body.rb @@ -0,0 +1,275 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **GET** `v1/vouchers`. + class VouchersListResponseBody + # The type of the object represented by JSON. + attr_accessor :object + + # Identifies the name of the attribute that contains the array of voucher objects. + attr_accessor :data_ref + + # A dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. + attr_accessor :vouchers + + # Returns how many vouchers in the project meet the limits defined by the query parameter definitions. + attr_accessor :total + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'data_ref' => :'data_ref', + :'vouchers' => :'vouchers', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'data_ref' => :'String', + :'vouchers' => :'Array', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'data_ref', + :'vouchers', + :'total' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'data_ref') + self.data_ref = attributes[:'data_ref'] + else + self.data_ref = 'vouchers' + end + + if attributes.key?(:'vouchers') + if (value = attributes[:'vouchers']).is_a?(Array) + self.vouchers = value + end + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + object_validator = EnumAttributeValidator.new('String', ["list"]) + return false unless object_validator.valid?(@object) + data_ref_validator = EnumAttributeValidator.new('String', ["vouchers"]) + return false unless data_ref_validator.valid?(@data_ref) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + data_ref == o.data_ref && + vouchers == o.vouchers && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, data_ref, vouchers, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_metadata_update_in_bulk_request_body.rb b/lib/VoucherifySdk/models/vouchers_metadata_update_in_bulk_request_body.rb new file mode 100644 index 00000000..883c9e5b --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_metadata_update_in_bulk_request_body.rb @@ -0,0 +1,223 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Request body schema for `vouchers/metadata/async`. + class VouchersMetadataUpdateInBulkRequestBody + # An array of voucher codes. + attr_accessor :codes + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'codes' => :'codes', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'codes' => :'Array', + :'metadata' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'codes', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'codes') + if (value = attributes[:'codes']).is_a?(Array) + self.codes = value + end + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + codes == o.codes && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [codes, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_metadata_update_in_bulk_response_body.rb b/lib/VoucherifySdk/models/vouchers_metadata_update_in_bulk_response_body.rb new file mode 100644 index 00000000..3dc0457c --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_metadata_update_in_bulk_response_body.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/vouchers/metadata/async`. + class VouchersMetadataUpdateInBulkResponseBody + # The ID of the scheduled asynchronous action. + attr_accessor :async_action_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'async_action_id' => :'async_action_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'async_action_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'async_action_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'async_action_id') + self.async_action_id = attributes[:'async_action_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + async_action_id == o.async_action_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [async_action_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_redemption_get_response_body.rb b/lib/VoucherifySdk/models/vouchers_redemption_get_response_body.rb index 6242c346..2fb73d47 100644 --- a/lib/VoucherifySdk/models/vouchers_redemption_get_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_redemption_get_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/vouchers/{code}/redemption`. + # Response body schema for **GET** `v1/vouchers/{code}/redemption`. class VouchersRedemptionGetResponseBody # The maximum number of times a voucher can be redeemed. attr_accessor :quantity @@ -22,7 +22,7 @@ class VouchersRedemptionGetResponseBody # The number of times the voucher was redeemed successfully. attr_accessor :redeemed_quantity - # The type of object represented by JSON. This object stores information about redemptions in a dictionary. + # The type of the object represented by JSON. This object stores information about redemptions in a dictionary. attr_accessor :object # URL @@ -64,7 +64,7 @@ def self.openapi_types :'url' => :'String', :'data_ref' => :'String', :'total' => :'Integer', - :'redemption_entries' => :'Array' + :'redemption_entries' => :'Array' } end @@ -72,34 +72,28 @@ def self.openapi_types def self.openapi_nullable Set.new([ :'quantity', + :'redeemed_quantity', + :'object', + :'url', + :'data_ref', + :'total', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersRedemptionGetResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersRedemptionGetResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] - else - self.quantity = nil end if attributes.key?(:'redeemed_quantity') self.redeemed_quantity = attributes[:'redeemed_quantity'] - else - self.redeemed_quantity = nil end if attributes.key?(:'object') @@ -110,8 +104,6 @@ def initialize(attributes = {}) if attributes.key?(:'url') self.url = attributes[:'url'] - else - self.url = nil end if attributes.key?(:'data_ref') @@ -122,8 +114,6 @@ def initialize(attributes = {}) if attributes.key?(:'total') self.total = attributes[:'total'] - else - self.total = nil end if attributes.key?(:'redemption_entries') @@ -140,26 +130,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @redeemed_quantity.nil? - invalid_properties.push('invalid value for "redeemed_quantity", redeemed_quantity cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @url.nil? - invalid_properties.push('invalid value for "url", url cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @total.nil? - invalid_properties.push('invalid value for "total", total cannot be nil.') - end - if @redemption_entries.nil? invalid_properties.push('invalid value for "redemption_entries", redemption_entries cannot be nil.') end @@ -171,11 +141,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @redeemed_quantity.nil? - return false if @object.nil? - return false if @url.nil? - return false if @data_ref.nil? - return false if @total.nil? return false if @redemption_entries.nil? true end diff --git a/lib/VoucherifySdk/models/vouchers_redemption_get_response_body_redemption_entries_item.rb b/lib/VoucherifySdk/models/vouchers_redemption_get_response_body_redemption_entries_item.rb deleted file mode 100644 index 480a1ab3..00000000 --- a/lib/VoucherifySdk/models/vouchers_redemption_get_response_body_redemption_entries_item.rb +++ /dev/null @@ -1,105 +0,0 @@ -=begin -#Voucherify API - -#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. - -The version of the OpenAPI document: v2018-08-01 -Contact: support@voucherify.io -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.0.1 - -=end - -require 'date' -require 'time' - -module VoucherifySdk - module VouchersRedemptionGetResponseBodyRedemptionEntriesItem - class << self - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'Redemption', - :'RedemptionRollback' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_one_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = VoucherifySdk.const_get(klass) - if const - if const.respond_to?(:openapi_one_of) # nested oneOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/lib/VoucherifySdk/models/vouchers_transactions_export_create_request_body.rb b/lib/VoucherifySdk/models/vouchers_transactions_export_create_request_body.rb index dfc009a3..a1172019 100644 --- a/lib/VoucherifySdk/models/vouchers_transactions_export_create_request_body.rb +++ b/lib/VoucherifySdk/models/vouchers_transactions_export_create_request_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Request body schema for **POST** `/vouchers/transactions/export`. + # Request body schema for **POST** `v1/vouchers/transactions/export`. class VouchersTransactionsExportCreateRequestBody attr_accessor :parameters @@ -46,15 +46,8 @@ def self.openapi_nullable # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersTransactionsExportCreateRequestBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersTransactionsExportCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } diff --git a/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body.rb b/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body.rb index 341f31e6..68a058c6 100644 --- a/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body.rb @@ -14,7 +14,7 @@ require 'time' module VoucherifySdk - # Response body schema for **POST** `/vouchers/{code}/transactions/export`. + # Response body schema for **POST** `v1/vouchers/{code}/transactions/export`. class VouchersTransactionsExportCreateResponseBody # Unique export ID. attr_accessor :id @@ -93,7 +93,7 @@ def self.openapi_types :'channel' => :'String', :'exported_object' => :'String', :'parameters' => :'VoucherTransactionsFilters', - :'result' => :'VoucherTransactionsExportResult', + :'result' => :'VouchersTransactionsExportCreateResponseBodyResult', :'user_id' => :'String' } end @@ -101,37 +101,27 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'id', + :'object', + :'created_at', + :'status', + :'channel', + :'exported_object', :'result', :'user_id' ]) end - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'VoucherTransactionsExport' - ] - end - # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersTransactionsExportCreateResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersTransactionsExportCreateResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] - else - self.id = nil end if attributes.key?(:'object') @@ -142,8 +132,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] - else - self.created_at = nil end if attributes.key?(:'status') @@ -172,14 +160,10 @@ def initialize(attributes = {}) if attributes.key?(:'result') self.result = attributes[:'result'] - else - self.result = nil end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] - else - self.user_id = nil end end @@ -188,30 +172,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @id.nil? - invalid_properties.push('invalid value for "id", id cannot be nil.') - end - - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @created_at.nil? - invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') - end - - if @status.nil? - invalid_properties.push('invalid value for "status", status cannot be nil.') - end - - if @channel.nil? - invalid_properties.push('invalid value for "channel", channel cannot be nil.') - end - - if @exported_object.nil? - invalid_properties.push('invalid value for "exported_object", exported_object cannot be nil.') - end - if @parameters.nil? invalid_properties.push('invalid value for "parameters", parameters cannot be nil.') end @@ -223,52 +183,16 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @id.nil? - return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["export"]) return false unless object_validator.valid?(@object) - return false if @created_at.nil? - return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) return false unless status_validator.valid?(@status) - return false if @channel.nil? - return false if @exported_object.nil? exported_object_validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) return false unless exported_object_validator.valid?(@exported_object) return false if @parameters.nil? true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] object Object to be assigned - def object=(object) - validator = EnumAttributeValidator.new('String', ["export"]) - unless validator.valid?(object) - fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." - end - @object = object - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] exported_object Object to be assigned - def exported_object=(exported_object) - validator = EnumAttributeValidator.new('String', ["voucher_transactions"]) - unless validator.valid?(exported_object) - fail ArgumentError, "invalid value for \"exported_object\", must be one of #{validator.allowable_values}." - end - @exported_object = exported_object - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body_result.rb b/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body_result.rb new file mode 100644 index 00000000..99e9eb56 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_transactions_export_create_response_body_result.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Contains the URL of the CSV file. + class VouchersTransactionsExportCreateResponseBodyResult + # URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_transactions_list_response_body.rb b/lib/VoucherifySdk/models/vouchers_transactions_list_response_body.rb index 7898b13b..c00f8e70 100644 --- a/lib/VoucherifySdk/models/vouchers_transactions_list_response_body.rb +++ b/lib/VoucherifySdk/models/vouchers_transactions_list_response_body.rb @@ -14,9 +14,9 @@ require 'time' module VoucherifySdk - # Response body schema for **GET** `/vouchers/{code}/transactions`. + # Response body schema for **GET** `v1/vouchers/{code}/transactions`. class VouchersTransactionsListResponseBody - # The type of object represented by JSON. + # The type of the object represented by JSON. attr_accessor :object # Identifies the name of the attribute that contains the array of transaction objects. @@ -25,7 +25,7 @@ class VouchersTransactionsListResponseBody # A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. attr_accessor :data - # As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results. + # As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. attr_accessor :has_more # Attribute mapping from ruby-style variable name to JSON key. @@ -56,21 +56,18 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'object', + :'data_ref', + :'data', + :'has_more' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::VouchersTransactionsListResponseBody` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::VouchersTransactionsListResponseBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect - end h[k.to_sym] = v } @@ -90,14 +87,10 @@ def initialize(attributes = {}) if (value = attributes[:'data']).is_a?(Array) self.data = value end - else - self.data = nil end if attributes.key?(:'has_more') self.has_more = attributes[:'has_more'] - else - self.has_more = nil end end @@ -106,22 +99,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @object.nil? - invalid_properties.push('invalid value for "object", object cannot be nil.') - end - - if @data_ref.nil? - invalid_properties.push('invalid value for "data_ref", data_ref cannot be nil.') - end - - if @data.nil? - invalid_properties.push('invalid value for "data", data cannot be nil.') - end - - if @has_more.nil? - invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') - end - invalid_properties end @@ -129,10 +106,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @object.nil? - return false if @data_ref.nil? - return false if @data.nil? - return false if @has_more.nil? true end diff --git a/lib/VoucherifySdk/models/vouchers_update_in_bulk_item_request_body.rb b/lib/VoucherifySdk/models/vouchers_update_in_bulk_item_request_body.rb new file mode 100644 index 00000000..eddda1fd --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_in_bulk_item_request_body.rb @@ -0,0 +1,220 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class VouchersUpdateInBulkItemRequestBody + # Unique voucher code. + attr_accessor :code + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'String', + :'metadata' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'code', + :'metadata' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_in_bulk_response_body.rb b/lib/VoucherifySdk/models/vouchers_update_in_bulk_response_body.rb new file mode 100644 index 00000000..af37b398 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_in_bulk_response_body.rb @@ -0,0 +1,210 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **POST** `v1/vouchers/bulk/async`. + class VouchersUpdateInBulkResponseBody + # The ID of the scheduled asynchronous action. + attr_accessor :async_action_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'async_action_id' => :'async_action_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'async_action_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'async_action_id' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'async_action_id') + self.async_action_id = attributes[:'async_action_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + async_action_id == o.async_action_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [async_action_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_request_body.rb b/lib/VoucherifySdk/models/vouchers_update_request_body.rb new file mode 100644 index 00000000..545b863a --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_request_body.rb @@ -0,0 +1,365 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + class VouchersUpdateRequestBody + # The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + attr_accessor :category + + # Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + attr_accessor :category_id + + # Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + attr_accessor :metadata + + attr_accessor :type + + attr_accessor :loyalty_card + + attr_accessor :gift + + attr_accessor :discount + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category', + :'category_id' => :'category_id', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'type' => :'type', + :'loyalty_card' => :'loyalty_card', + :'gift' => :'gift', + :'discount' => :'discount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'category' => :'String', + :'category_id' => :'String', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'type' => :'String', + :'loyalty_card' => :'SimpleLoyaltyCard', + :'gift' => :'Gift', + :'discount' => :'Discount' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'category', + :'category_id', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'type', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["LOYALTY_CARD", "GIFT_VOUCHER", "DISCOUNT_VOUCHER"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + category_id == o.category_id && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + type == o.type && + loyalty_card == o.loyalty_card && + gift == o.gift && + discount == o.discount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [category, category_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, type, loyalty_card, gift, discount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_response_body.rb b/lib/VoucherifySdk/models/vouchers_update_response_body.rb new file mode 100644 index 00000000..a02138f5 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_response_body.rb @@ -0,0 +1,533 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Response body schema for **PUT** `v1/vouchers/{code}`. + class VouchersUpdateResponseBody + # Assigned by the Voucherify API, identifies the voucher. + attr_accessor :id + + # A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + attr_accessor :code + + # A unique campaign name, identifies the voucher's parent campaign. + attr_accessor :campaign + + # Assigned by the Voucherify API, identifies the voucher's parent campaign. + attr_accessor :campaign_id + + # Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + attr_accessor :category + + # Unique category ID assigned by Voucherify. + attr_accessor :category_id + + # Defines the type of the voucher. + attr_accessor :type + + attr_accessor :discount + + attr_accessor :gift + + attr_accessor :loyalty_card + + # Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + attr_accessor :start_date + + # Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + attr_accessor :expiration_date + + attr_accessor :validity_timeframe + + # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + attr_accessor :validity_day_of_week + + attr_accessor :validity_hours + + # A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + attr_accessor :active + + # An optional field to keep any extra textual information about the code such as a code description and details. + attr_accessor :additional_info + + # The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + attr_accessor :metadata + + attr_accessor :assets + + # Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + attr_accessor :is_referral_code + + # Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + attr_accessor :created_at + + # Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + attr_accessor :updated_at + + # Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + attr_accessor :holder_id + + # Unique identifier of the referring person. + attr_accessor :referrer_id + + # The type of the object represented by JSON. Default is `voucher`. + attr_accessor :object + + attr_accessor :publish + + attr_accessor :redemption + + # Contains details about the category. + attr_accessor :categories + + attr_accessor :validation_rules_assignments + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'code' => :'code', + :'campaign' => :'campaign', + :'campaign_id' => :'campaign_id', + :'category' => :'category', + :'category_id' => :'category_id', + :'type' => :'type', + :'discount' => :'discount', + :'gift' => :'gift', + :'loyalty_card' => :'loyalty_card', + :'start_date' => :'start_date', + :'expiration_date' => :'expiration_date', + :'validity_timeframe' => :'validity_timeframe', + :'validity_day_of_week' => :'validity_day_of_week', + :'validity_hours' => :'validity_hours', + :'active' => :'active', + :'additional_info' => :'additional_info', + :'metadata' => :'metadata', + :'assets' => :'assets', + :'is_referral_code' => :'is_referral_code', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'holder_id' => :'holder_id', + :'referrer_id' => :'referrer_id', + :'object' => :'object', + :'publish' => :'publish', + :'redemption' => :'redemption', + :'categories' => :'categories', + :'validation_rules_assignments' => :'validation_rules_assignments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'code' => :'String', + :'campaign' => :'String', + :'campaign_id' => :'String', + :'category' => :'String', + :'category_id' => :'String', + :'type' => :'String', + :'discount' => :'Discount', + :'gift' => :'VouchersUpdateResponseBodyGift', + :'loyalty_card' => :'VouchersUpdateResponseBodyLoyaltyCard', + :'start_date' => :'Time', + :'expiration_date' => :'Time', + :'validity_timeframe' => :'ValidityTimeframe', + :'validity_day_of_week' => :'Array', + :'validity_hours' => :'ValidityHours', + :'active' => :'Boolean', + :'additional_info' => :'String', + :'metadata' => :'Object', + :'assets' => :'VoucherAssets', + :'is_referral_code' => :'Boolean', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'holder_id' => :'String', + :'referrer_id' => :'String', + :'object' => :'String', + :'publish' => :'VouchersUpdateResponseBodyPublish', + :'redemption' => :'VouchersUpdateResponseBodyRedemption', + :'categories' => :'Array', + :'validation_rules_assignments' => :'ValidationRulesAssignmentsList' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'code', + :'campaign', + :'campaign_id', + :'category', + :'category_id', + :'type', + :'gift', + :'loyalty_card', + :'start_date', + :'expiration_date', + :'active', + :'additional_info', + :'metadata', + :'is_referral_code', + :'created_at', + :'updated_at', + :'holder_id', + :'referrer_id', + :'object', + :'publish', + :'redemption', + :'categories', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'discount') + self.discount = attributes[:'discount'] + end + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + + if attributes.key?(:'loyalty_card') + self.loyalty_card = attributes[:'loyalty_card'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'validity_timeframe') + self.validity_timeframe = attributes[:'validity_timeframe'] + end + + if attributes.key?(:'validity_day_of_week') + if (value = attributes[:'validity_day_of_week']).is_a?(Array) + self.validity_day_of_week = value + end + end + + if attributes.key?(:'validity_hours') + self.validity_hours = attributes[:'validity_hours'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'additional_info') + self.additional_info = attributes[:'additional_info'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'assets') + self.assets = attributes[:'assets'] + end + + if attributes.key?(:'is_referral_code') + self.is_referral_code = attributes[:'is_referral_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'holder_id') + self.holder_id = attributes[:'holder_id'] + end + + if attributes.key?(:'referrer_id') + self.referrer_id = attributes[:'referrer_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'voucher' + end + + if attributes.key?(:'publish') + self.publish = attributes[:'publish'] + end + + if attributes.key?(:'redemption') + self.redemption = attributes[:'redemption'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'validation_rules_assignments') + self.validation_rules_assignments = attributes[:'validation_rules_assignments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["GIFT_VOUCHER", "DISCOUNT_VOUCHER", "LOYALTY_CARD"]) + return false unless type_validator.valid?(@type) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + code == o.code && + campaign == o.campaign && + campaign_id == o.campaign_id && + category == o.category && + category_id == o.category_id && + type == o.type && + discount == o.discount && + gift == o.gift && + loyalty_card == o.loyalty_card && + start_date == o.start_date && + expiration_date == o.expiration_date && + validity_timeframe == o.validity_timeframe && + validity_day_of_week == o.validity_day_of_week && + validity_hours == o.validity_hours && + active == o.active && + additional_info == o.additional_info && + metadata == o.metadata && + assets == o.assets && + is_referral_code == o.is_referral_code && + created_at == o.created_at && + updated_at == o.updated_at && + holder_id == o.holder_id && + referrer_id == o.referrer_id && + object == o.object && + publish == o.publish && + redemption == o.redemption && + categories == o.categories && + validation_rules_assignments == o.validation_rules_assignments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, code, campaign, campaign_id, category, category_id, type, discount, gift, loyalty_card, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, active, additional_info, metadata, assets, is_referral_code, created_at, updated_at, holder_id, referrer_id, object, publish, redemption, categories, validation_rules_assignments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_response_body_gift.rb b/lib/VoucherifySdk/models/vouchers_update_response_body_gift.rb new file mode 100644 index 00000000..acf98287 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_response_body_gift.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + class VouchersUpdateResponseBodyGift + # Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :amount + + # Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + attr_accessor :balance + + # Defines how the credits are applied to the customer's order. + attr_accessor :effect + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'balance' => :'balance', + :'effect' => :'effect' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'balance' => :'Integer', + :'effect' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'amount', + :'balance', + :'effect' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'effect') + self.effect = attributes[:'effect'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + effect_validator = EnumAttributeValidator.new('String', ["APPLY_TO_ORDER", "APPLY_TO_ITEMS"]) + return false unless effect_validator.valid?(@effect) + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + balance == o.balance && + effect == o.effect + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, balance, effect].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_response_body_loyalty_card.rb b/lib/VoucherifySdk/models/vouchers_update_response_body_loyalty_card.rb new file mode 100644 index 00000000..19a89162 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_response_body_loyalty_card.rb @@ -0,0 +1,243 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + class VouchersUpdateResponseBodyLoyaltyCard + # Total points incurred over the lifespan of the loyalty card. + attr_accessor :points + + # Points available for reward redemption. + attr_accessor :balance + + # The next closest date when the next set of points are due to expire. + attr_accessor :next_expiration_date + + # The amount of points that are set to expire next. + attr_accessor :next_expiration_points + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'points' => :'points', + :'balance' => :'balance', + :'next_expiration_date' => :'next_expiration_date', + :'next_expiration_points' => :'next_expiration_points' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'points' => :'Integer', + :'balance' => :'Integer', + :'next_expiration_date' => :'Date', + :'next_expiration_points' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'points', + :'balance', + :'next_expiration_date', + :'next_expiration_points' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'next_expiration_date') + self.next_expiration_date = attributes[:'next_expiration_date'] + end + + if attributes.key?(:'next_expiration_points') + self.next_expiration_points = attributes[:'next_expiration_points'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + points == o.points && + balance == o.balance && + next_expiration_date == o.next_expiration_date && + next_expiration_points == o.next_expiration_points + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [points, balance, next_expiration_date, next_expiration_points].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_response_body_publish.rb b/lib/VoucherifySdk/models/vouchers_update_response_body_publish.rb new file mode 100644 index 00000000..a724673a --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_response_body_publish.rb @@ -0,0 +1,234 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + class VouchersUpdateResponseBodyPublish + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + attr_accessor :object + + # Publication events counter. + attr_accessor :count + + # The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'count' => :'count', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'count' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'object', + :'count', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + count == o.count && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, count, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/models/vouchers_update_response_body_redemption.rb b/lib/VoucherifySdk/models/vouchers_update_response_body_redemption.rb new file mode 100644 index 00000000..38474d73 --- /dev/null +++ b/lib/VoucherifySdk/models/vouchers_update_response_body_redemption.rb @@ -0,0 +1,256 @@ +=begin +#Voucherify API + +#Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + +The version of the OpenAPI document: v2018-08-01 +Contact: support@voucherify.io +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.1 + +=end + +require 'date' +require 'time' + +module VoucherifySdk + # Stores a summary of redemptions that have been applied to the voucher. + class VouchersUpdateResponseBodyRedemption + # How many times a voucher can be redeemed. A `null` value means unlimited. + attr_accessor :quantity + + # How many times a voucher has already been redeemed. + attr_accessor :redeemed_quantity + + # Total loyalty points redeemed. + attr_accessor :redeemed_points + + # The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + attr_accessor :object + + # The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'redeemed_quantity' => :'redeemed_quantity', + :'redeemed_points' => :'redeemed_points', + :'object' => :'object', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Integer', + :'redeemed_quantity' => :'Integer', + :'redeemed_points' => :'Integer', + :'object' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'quantity', + :'redeemed_quantity', + :'redeemed_points', + :'object', + :'url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'redeemed_quantity') + self.redeemed_quantity = attributes[:'redeemed_quantity'] + end + + if attributes.key?(:'redeemed_points') + self.redeemed_points = attributes[:'redeemed_points'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = 'list' + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + quantity == o.quantity && + redeemed_quantity == o.redeemed_quantity && + redeemed_points == o.redeemed_points && + object == o.object && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, redeemed_quantity, redeemed_points, object, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = VoucherifySdk.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/VoucherifySdk/version.rb b/lib/VoucherifySdk/version.rb index 5d1e73d2..88012e8b 100644 --- a/lib/VoucherifySdk/version.rb +++ b/lib/VoucherifySdk/version.rb @@ -11,5 +11,5 @@ =end module VoucherifySdk - VERSION = '5.0.1' + VERSION = '6.0.0' end